From 0ef87537742cce5a8e7a30a9ba9b923f0f4d2dc9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 3 Sep 2019 09:09:06 +0200 Subject: [PATCH] Prospective fix for linking problems of qtdeclarative in the CI In the ICC configuration we can't build the qtbase libraries with ICC and qtdeclarative with gcc, mixing won't work well. On Windows we've covered this compiler mixing scenario using our toolchain file, but the ICC case makes it clear that we have to be consistent about caching the compiler in the toolchain file across platforms. Change-Id: Iad2005ab00655f902e5f5cea2f0563d790d8aa93 Reviewed-by: Alexandru Croitor --- cmake/QtBaseGlobalTargets.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index ecfb4429d2..df3ceb88c0 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -85,6 +85,11 @@ if(VCPKG_TARGET_TRIPLET) list(APPEND init_vcpkg "set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")") endif() +# 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%. The same goes when using a custom compiler on other platforms, such as ICC. +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 \"\")") + if(APPLE) if(CMAKE_OSX_SYSROOT) list(APPEND init_platform "set(CMAKE_OSX_SYSROOT \"${CMAKE_OSX_SYSROOT}\" CACHE PATH \"\")") @@ -92,11 +97,6 @@ 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 \"\")") elseif(ANDROID) list(APPEND init_platform "set(ANDROID_NATIVE_API_LEVEL \"${ANDROID_NATIVE_API_LEVEL}\" CACHE STRING \"\")") list(APPEND init_platform "set(ANDROID_STL \"${ANDROID_STL}\" CACHE STRING \"\")")