From 6fe92d5aed33bb02020e8416ebb862873da95e1b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 26 Jun 2019 13:54:37 +0200 Subject: 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 --- cmake/QtBaseGlobalTargets.cmake | 5 +++++ 1 file changed, 5 insertions(+) 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}") -- cgit v1.2.3