summaryrefslogtreecommitdiff
path: root/Modules/Platform
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-04-25 09:07:45 -0400
committerBrad King <brad.king@kitware.com>2013-04-25 09:07:45 -0400
commitf9eee7f1833856f690b4a8ef5f5aa44d9ccb8114 (patch)
tree12dcf6fdbc92b31a04ba1bcde066da95038279d8 /Modules/Platform
parent90bd16419343ada9f026ce8387fafff9c3546a10 (diff)
downloadcmake-f9eee7f1833856f690b4a8ef5f5aa44d9ccb8114.tar.gz
Windows: Search '/' prefix only when cross compiling (#10994)
Commit dac78148 (...makes the mingw cross compiler work out of the box..., 2007-08-02) added to CMAKE_SYSTEM_PROGRAM_PATH and CMAKE_SYSTEM_LIBRARY_PATH paths like "/bin" and "/lib" with no Windows drive letter so that cross-compiling to Windows from Linux would search these paths under CMAKE_FIND_ROOT_PATH. Later commit 2a782880 (...use CMAKE_SYSTEM_PREFIX_PATH when possible, 2008-01-16) generalized this approach by instead adding "/" to CMAKE_SYSTEM_PREFIX_PATH. Both commits assumed that the paths would never match anything on Windows hosts without a drive letter. However, Windows evaluates these paths relative to the current working drive letter so find_* commands may report paths like "/lib/..." when paths like "c:/lib/..." exist on what happens to be current drive. Such drive-less paths are not reliable when the working drive changes, so we should not use them. Fix WindowsPaths.cmake to add '/' to CMAKE_SYSTEM_PREFIX_PATH only when cross-compiling to Windows from a non-Windows host. This will avoid searching and finding local paths without a drive letter on Windows.
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/WindowsPaths.cmake6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index bd31da021a..fc921d793e 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -77,10 +77,12 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}")
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# Project install destination.
"${CMAKE_INSTALL_PREFIX}"
+ )
+if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
# MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
- /
- )
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH /)
+endif()
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
)