From 3aa6f0b3961322a40f046cfb39a40d118f57216e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Tue, 23 May 2023 10:56:36 +0200 Subject: CMake: Use stored compiler only for qt-cmake-private Change the heuristic only to use the stored compiler if we are building qt itself, like with qt-cmake-private / qt-configure-module. qt-cmake is also used by end-users, where the heuristic to change the compiler default base on paths is surprising, and can go wrong. Fixes: QTBUG-108323 Pick-to: 6.6 Change-Id: I0274e470f214a84711013d77068551f9097f4685 Reviewed-by: Joerg Bornemann Reviewed-by: Qt CI Bot --- cmake/QtWrapperScriptHelpers.cmake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'cmake/QtWrapperScriptHelpers.cmake') diff --git a/cmake/QtWrapperScriptHelpers.cmake b/cmake/QtWrapperScriptHelpers.cmake index 628d5a77dd..9d7460fb53 100644 --- a/cmake/QtWrapperScriptHelpers.cmake +++ b/cmake/QtWrapperScriptHelpers.cmake @@ -53,15 +53,16 @@ function(qt_internal_create_wrapper_scripts) qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake-create.bat" DESTINATION "${INSTALL_BINDIR}") endif() - # Provide a private convenience wrapper with options which should not be propagated via the + # Provide a private convenience wrapper with options that should not be propagated via the # public qt-cmake wrapper e.g. CMAKE_GENERATOR. # These options can not be set in a toolchain file, but only on the command line. # These options should not be in the public wrapper, because a consumer of Qt might want to # build their CMake app with the Unix Makefiles generator, while Qt should be built with the - # Ninja generator. - # The private wrapper is more conveient for building Qt itself, because a developer doesn't need - # to specify the same options for each qt module built. - set(__qt_cmake_extra "-G\"${CMAKE_GENERATOR}\"") + # Ninja generator. In a similar vein, we do want to use the same compiler for all Qt modules, + # but not for user applications. + # The private wrapper is more convenient for building Qt itself, because a developer doesn't + # need to specify the same options for each qt module built. + set(__qt_cmake_extra "-G\"${CMAKE_GENERATOR}\" -DQT_USE_ORIGINAL_COMPILER=ON") if(generate_unix) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.in" "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-cmake-private" @ONLY @@ -231,7 +232,7 @@ function(qt_internal_create_qt_configure_tests_wrapper_script) # The script takes a path to the repo for which the standalone tests will be configured. set(script_name "qt-internal-configure-tests") - set(script_passed_args "-DQT_BUILD_STANDALONE_TESTS=ON") + set(script_passed_args "-DQT_BUILD_STANDALONE_TESTS=ON -DQT_USE_ORIGINAL_COMPILER=ON") file(RELATIVE_PATH relative_path_from_libexec_dir_to_bin_dir ${__qt_libexec_dir_absolute} -- cgit v1.2.3