UnixPaths.cmake 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # Block multiple inclusion because "CMakeCInformation.cmake" includes
  4. # "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module
  5. # "CMakeSystemSpecificInformation.cmake" already included it.
  6. # The extra inclusion is a work-around documented next to the include()
  7. # call, so this can be removed when the work-around is removed.
  8. if(__UNIX_PATHS_INCLUDED)
  9. return()
  10. endif()
  11. set(__UNIX_PATHS_INCLUDED 1)
  12. set(UNIX 1)
  13. # also add the install directory of the running cmake to the search directories
  14. # CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up
  15. get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH)
  16. get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
  17. # List common installation prefixes. These will be used for all
  18. # search types.
  19. list(APPEND CMAKE_SYSTEM_PREFIX_PATH
  20. # Standard
  21. /usr/local /usr /
  22. # CMake install location
  23. "${_CMAKE_INSTALL_DIR}"
  24. )
  25. if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
  26. list(APPEND CMAKE_SYSTEM_PREFIX_PATH
  27. # Project install destination.
  28. "${CMAKE_INSTALL_PREFIX}"
  29. )
  30. if(CMAKE_STAGING_PREFIX)
  31. list(APPEND CMAKE_SYSTEM_PREFIX_PATH
  32. # User-supplied staging prefix.
  33. "${CMAKE_STAGING_PREFIX}"
  34. )
  35. endif()
  36. endif()
  37. # Non "standard" but common install prefixes
  38. list(APPEND CMAKE_SYSTEM_PREFIX_PATH
  39. /usr/X11R6
  40. /usr/pkg
  41. /opt
  42. )
  43. # List common include file locations not under the common prefixes.
  44. list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
  45. # X11
  46. /usr/include/X11
  47. )
  48. list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
  49. # X11
  50. /usr/lib/X11
  51. )
  52. list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
  53. /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
  54. )
  55. list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
  56. /usr/include
  57. )
  58. list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
  59. /usr/include
  60. )
  61. list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES
  62. /usr/include
  63. )
  64. # Enable use of lib32 and lib64 search path variants by default.
  65. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE)
  66. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
  67. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS TRUE)