WindowsPaths.cmake 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #=============================================================================
  2. # Copyright 2006-2009 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # Block multiple inclusion because "CMakeCInformation.cmake" includes
  14. # "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module
  15. # "CMakeSystemSpecificInformation.cmake" already included it.
  16. # The extra inclusion is a work-around documented next to the include()
  17. # call, so this can be removed when the work-around is removed.
  18. if(__WINDOWS_PATHS_INCLUDED)
  19. return()
  20. endif()
  21. set(__WINDOWS_PATHS_INCLUDED 1)
  22. # Add the program-files folder(s) to the list of installation
  23. # prefixes.
  24. #
  25. # Windows 64-bit Binary:
  26. # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
  27. # ENV{ProgramFiles} = [C:\Program Files]
  28. # ENV{ProgramW6432} = <not set>
  29. # (executed from cygwin):
  30. # ENV{ProgramFiles(x86)} = <not set>
  31. # ENV{ProgramFiles} = [C:\Program Files]
  32. # ENV{ProgramW6432} = <not set>
  33. #
  34. # Windows 32-bit Binary:
  35. # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
  36. # ENV{ProgramFiles} = [C:\Program Files (x86)]
  37. # ENV{ProgramW6432} = [C:\Program Files]
  38. # (executed from cygwin):
  39. # ENV{ProgramFiles(x86)} = <not set>
  40. # ENV{ProgramFiles} = [C:\Program Files (x86)]
  41. # ENV{ProgramW6432} = [C:\Program Files]
  42. if(DEFINED "ENV{ProgramW6432}")
  43. # 32-bit binary on 64-bit windows.
  44. # The 64-bit program files are in ProgramW6432.
  45. list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}")
  46. # The 32-bit program files are in ProgramFiles.
  47. if(DEFINED "ENV{ProgramFiles}")
  48. list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
  49. endif()
  50. else()
  51. # 64-bit binary, or 32-bit binary on 32-bit windows.
  52. if(DEFINED "ENV{ProgramFiles}")
  53. list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
  54. endif()
  55. if(DEFINED "ENV{ProgramFiles(x86)}")
  56. # 64-bit binary. 32-bit program files are in ProgramFiles(x86).
  57. list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles(x86)}")
  58. elseif(DEFINED "ENV{SystemDrive}")
  59. # Guess the 32-bit program files location.
  60. if(EXISTS "$ENV{SystemDrive}/Program Files (x86)")
  61. list(APPEND CMAKE_SYSTEM_PREFIX_PATH
  62. "$ENV{SystemDrive}/Program Files (x86)")
  63. endif()
  64. endif()
  65. endif()
  66. # Add the CMake install location.
  67. get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH)
  68. get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
  69. list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}")
  70. if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
  71. # Add other locations.
  72. list(APPEND CMAKE_SYSTEM_PREFIX_PATH
  73. # Project install destination.
  74. "${CMAKE_INSTALL_PREFIX}"
  75. )
  76. if (CMAKE_STAGING_PREFIX)
  77. list(APPEND CMAKE_SYSTEM_PREFIX_PATH
  78. # User-supplied staging prefix.
  79. "${CMAKE_STAGING_PREFIX}"
  80. )
  81. endif()
  82. endif()
  83. if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
  84. # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
  85. list(APPEND CMAKE_SYSTEM_PREFIX_PATH /)
  86. endif()
  87. list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
  88. )
  89. # mingw can also link against dlls which can also be in /bin, so list this too
  90. if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
  91. list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
  92. "${CMAKE_INSTALL_PREFIX}/bin"
  93. )
  94. if (CMAKE_STAGING_PREFIX)
  95. list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
  96. "${CMAKE_STAGING_PREFIX}/bin"
  97. )
  98. endif()
  99. endif()
  100. list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
  101. "${_CMAKE_INSTALL_DIR}/bin"
  102. /bin
  103. )
  104. list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
  105. )