1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4 5# Block multiple inclusion because "CMakeCInformation.cmake" includes 6# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module 7# "CMakeSystemSpecificInformation.cmake" already included it. 8# The extra inclusion is a work-around documented next to the include() 9# call, so this can be removed when the work-around is removed. 10if(__WINDOWS_PATHS_INCLUDED) 11 return() 12endif() 13set(__WINDOWS_PATHS_INCLUDED 1) 14 15# Add the program-files folder(s) to the list of installation 16# prefixes. 17# 18# Windows 64-bit Binary: 19# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] 20# ENV{ProgramFiles} = [C:\Program Files] 21# ENV{ProgramW6432} = [C:\Program Files] or <not set> 22# 23# Windows 32-bit Binary on 64-bit Windows: 24# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] 25# ENV{ProgramFiles} = [C:\Program Files (x86)] 26# ENV{ProgramW6432} = [C:\Program Files] 27# 28# Reminder when adding new locations computed from environment variables 29# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst 30# synchronized 31set(_programfiles "") 32foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)") 33 if(DEFINED "ENV{${v}}") 34 file(TO_CMAKE_PATH "$ENV{${v}}" _env_programfiles) 35 list(APPEND _programfiles "${_env_programfiles}") 36 unset(_env_programfiles) 37 endif() 38endforeach() 39if(DEFINED "ENV{SystemDrive}") 40 foreach(d "Program Files" "Program Files (x86)") 41 if(EXISTS "$ENV{SystemDrive}/${d}") 42 list(APPEND _programfiles "$ENV{SystemDrive}/${d}") 43 endif() 44 endforeach() 45endif() 46if(_programfiles) 47 list(REMOVE_DUPLICATES _programfiles) 48 list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_programfiles}) 49endif() 50unset(_programfiles) 51 52# Add the CMake install location. 53get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) 54get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) 55list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}") 56 57if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) 58 # Add other locations. 59 list(APPEND CMAKE_SYSTEM_PREFIX_PATH 60 # Project install destination. 61 "${CMAKE_INSTALL_PREFIX}" 62 ) 63 if (CMAKE_STAGING_PREFIX) 64 list(APPEND CMAKE_SYSTEM_PREFIX_PATH 65 # User-supplied staging prefix. 66 "${CMAKE_STAGING_PREFIX}" 67 ) 68 endif() 69endif() 70 71if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") 72 # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set) 73 list(APPEND CMAKE_SYSTEM_PREFIX_PATH /) 74endif() 75 76list(APPEND CMAKE_SYSTEM_INCLUDE_PATH 77 ) 78 79# mingw can also link against dlls which can also be in /bin, so list this too 80if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) 81 list(APPEND CMAKE_SYSTEM_LIBRARY_PATH 82 "${CMAKE_INSTALL_PREFIX}/bin" 83 ) 84 if (CMAKE_STAGING_PREFIX) 85 list(APPEND CMAKE_SYSTEM_LIBRARY_PATH 86 "${CMAKE_STAGING_PREFIX}/bin" 87 ) 88 endif() 89endif() 90list(APPEND CMAKE_SYSTEM_LIBRARY_PATH 91 "${_CMAKE_INSTALL_DIR}/bin" 92 /bin 93 ) 94 95list(APPEND CMAKE_SYSTEM_PROGRAM_PATH 96 ) 97