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>
This commit is contained in:
Simon Hausmann 2019-06-26 13:54:37 +02:00
parent 5efdf54f84
commit 6fe92d5aed

View File

@ -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}")