Merge topic 'mingw-search-prefixes'

5e5132e1b1 MinGW: Search for packages in standard MSYSTEM environment prefixes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8796
This commit is contained in:
Brad King
2023-09-14 16:50:26 +00:00
committed by Kitware Robot
20 changed files with 75 additions and 4 deletions

View File

@@ -10,6 +10,25 @@ set(__WINDOWS_GNU 1)
set(MINGW 1)
# On Windows hosts, in MSYSTEM environments, search standard prefixes.
if(CMAKE_HOST_WIN32)
# Bootstrap CMake does not have cmake_host_system_information.
if(COMMAND cmake_host_system_information)
cmake_host_system_information(RESULT _MSYSTEM_PREFIX QUERY MSYSTEM_PREFIX)
elseif(IS_DIRECTORY "$ENV{MSYSTEM_PREFIX}")
set(_MSYSTEM_PREFIX "$ENV{MSYSTEM_PREFIX}")
endif()
# Search this MSYSTEM environment's equivalent to /usr/local and /usr.
if(_MSYSTEM_PREFIX)
list(PREPEND CMAKE_SYSTEM_PREFIX_PATH "${_MSYSTEM_PREFIX}")
if(IS_DIRECTORY "${_MSYSTEM_PREFIX}/local")
list(PREPEND CMAKE_SYSTEM_PREFIX_PATH "${_MSYSTEM_PREFIX}/local")
endif()
endif()
unset(_MSYSTEM_PREFIX)
endif()
set(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_MODULE_PREFIX "lib")