diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-08-02 14:22:54 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-03 17:24:03 +0000 |
commit | d59648486bd6429d1e4b3ef070254c30696b5721 (patch) | |
tree | 5484e2948d25b945ece270dcfc1a0d4371ab1960 /cmake | |
parent | 1e7a33fcd167e182c76a4c390e0d372d572c6c92 (diff) |
CMake: Fix single standalone tests to use same Qt C++ language std
When using qt-cmake-standalone-test, we didn't tell CMake to use the
same C++ language standard that Qt used when it was configured.
We did tell CMake to do that when configuring tests with
qt-internal-configure-tests via the qt_build_tests macro.
To ensure the proper standard is set, we also need to
find_package(Qt6Core), because the std flag is derived from the
QT_FEATURE_cxxyz flag which is set by Core.
Change-Id: Ia41f2a24983ddab0107a6446743f7b054df8c033
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit effd6f63f1a4b7dc7b5e6bca41594f1d1562a713)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt index 564ed610c8..368567c708 100644 --- a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt +++ b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.16) project(qt_single_test VERSION 6.0.0 LANGUAGES C CXX ASM) -find_package(Qt6 REQUIRED COMPONENTS BuildInternals) +find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core) include(${CMAKE_CURRENT_LIST_DIR}/Main.cmake) diff --git a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake index 3f8f8c3980..2ea0beb113 100644 --- a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake +++ b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake @@ -12,6 +12,10 @@ foreach(file ${config_files}) include("${file}") endforeach() +# Set language standards after finding Core, because that's when the relevant +# feature variables are available. +qt_set_language_standards() + # Just before adding the test, change the local (non-cache) install prefix to something other than # the Qt install prefix, so that tests don't try to install and pollute the Qt install prefix. # Needs to be called after qt_get_standalone_tests_confg_files_path(). |