WindowsPaths.cmake 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 distributed this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # Add the program-files folder(s) to the list of installation
  14. # prefixes.
  15. #
  16. # Windows 64-bit Binary:
  17. # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
  18. # ENV{ProgramFiles} = [C:\Program Files]
  19. # ENV{ProgramW6432} = <not set>
  20. # (executed from cygwin):
  21. # ENV{ProgramFiles(x86)} = <not set>
  22. # ENV{ProgramFiles} = [C:\Program Files]
  23. # ENV{ProgramW6432} = <not set>
  24. #
  25. # Windows 32-bit Binary:
  26. # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
  27. # ENV{ProgramFiles} = [C:\Program Files (x86)]
  28. # ENV{ProgramW6432} = [C:\Program Files]
  29. # (executed from cygwin):
  30. # ENV{ProgramFiles(x86)} = <not set>
  31. # ENV{ProgramFiles} = [C:\Program Files (x86)]
  32. # ENV{ProgramW6432} = [C:\Program Files]
  33. IF(DEFINED "ENV{ProgramW6432}")
  34. # 32-bit binary on 64-bit windows.
  35. # The 64-bit program files are in ProgramW6432.
  36. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}")
  37. # The 32-bit program files are in ProgramFiles.
  38. IF(DEFINED "ENV{ProgramFiles}")
  39. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
  40. ENDIF()
  41. ELSE()
  42. # 64-bit binary, or 32-bit binary on 32-bit windows.
  43. IF(DEFINED "ENV{ProgramFiles}")
  44. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
  45. ENDIF()
  46. IF(DEFINED "ENV{ProgramFiles(x86)}")
  47. # 64-bit binary. 32-bit program files are in ProgramFiles(x86).
  48. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles(x86)}")
  49. ELSEIF(DEFINED "ENV{SystemDrive}")
  50. # Guess the 32-bit program files location.
  51. IF(EXISTS "$ENV{SystemDrive}/Program Files (x86)")
  52. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
  53. "$ENV{SystemDrive}/Program Files (x86)")
  54. ENDIF()
  55. ENDIF()
  56. ENDIF()
  57. # Add the CMake install location.
  58. GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH)
  59. GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
  60. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}")
  61. # Add other locations.
  62. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
  63. # Project install destination.
  64. "${CMAKE_INSTALL_PREFIX}"
  65. # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
  66. /
  67. )
  68. LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH
  69. )
  70. # mingw can also link against dlls which can also be in /bin, so list this too
  71. LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH
  72. "${CMAKE_INSTALL_PREFIX}/bin"
  73. "${_CMAKE_INSTALL_DIR}/bin"
  74. /bin
  75. )
  76. LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH
  77. )