WindowsPaths.cmake 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. # Add other locations.
  71. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
  72. # Project install destination.
  73. "${CMAKE_INSTALL_PREFIX}"
  74. # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
  75. /
  76. )
  77. LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH
  78. )
  79. # mingw can also link against dlls which can also be in /bin, so list this too
  80. LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH
  81. "${CMAKE_INSTALL_PREFIX}/bin"
  82. "${_CMAKE_INSTALL_DIR}/bin"
  83. /bin
  84. )
  85. LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH
  86. )