UnixPaths.cmake 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. if(CMAKE_SYSROOT_COMPILE)
  56. set(_cmake_sysroot_compile "${CMAKE_SYSROOT_COMPILE}")
  57. else()
  58. set(_cmake_sysroot_compile "${CMAKE_SYSROOT}")
  59. endif()
  60. # Default per-language values. These may be later replaced after
  61. # parsing the implicit directory information from compiler output.
  62. set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT
  63. ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
  64. "${_cmake_sysroot_compile}/usr/include"
  65. )
  66. set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT
  67. ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
  68. "${_cmake_sysroot_compile}/usr/include"
  69. )
  70. set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
  71. ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES}
  72. "${_cmake_sysroot_compile}/usr/include"
  73. )
  74. unset(_cmake_sysroot_compile)
  75. # Enable use of lib32 and lib64 search path variants by default.
  76. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE)
  77. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
  78. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS TRUE)