summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2019-06-26 13:54:37 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2019-06-26 12:41:39 +0000
commit6fe92d5aed33bb02020e8416ebb862873da95e1b (patch)
tree6f141e5a7d5b752cca5e3a71574341b24b25d5a2 /cmake
parent5efdf54f84e7f57536668b31f7a39c3e87692195 (diff)
Prospective fix for using qt-cmake when %PATH% changes and using Ninja
Mixing compilers won't work well on Windows, so if qtbase is built using cl.exe and Ninja and then later cmake is called on another module and gcc is found in %PATH%, then cmake will prefer that. Let's avoid that. Change-Id: I8294482939efa6a16e0a4df8df3aeef8243c3657 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBaseGlobalTargets.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index 3409d044ff..7380b36e26 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -85,6 +85,11 @@ if(APPLE)
if(CMAKE_OSX_DEPLOYMENT_TARGET)
list(APPEND init_platform "set(CMAKE_OSX_DEPLOYMENT_TARGET \"${CMAKE_OSX_DEPLOYMENT_TARGET}\" CACHE STRING \"\")")
endif()
+elseif(WIN32)
+ # On Windows compilers aren't easily mixed. Avoid that qtbase is built using cl.exe for example and then for another
+ # build gcc is picked up from %PATH%.
+ list(APPEND init_platform "set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\" CACHE STRING \"\")")
+ list(APPEND init_platform "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\" CACHE STRING \"\")")
endif()
string(REPLACE ";" "\n" init_vcpkg "${init_vcpkg}")