From 4ee289d2d84122201ecaba5ec27d394427527f9c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 18 Feb 2020 10:59:11 +0100 Subject: [PATCH] CMake: Use correct C++ standard flag when building standalone tests Before the patch we set the standard flags in two places: - once when building qtbase - and always when including QtSetup (for every repo that is built) This change makes sure to also set the correct standards flag when building standalone tests, because QtSetup is called to early in that case. Change-Id: Iad130b731e9eb9605bb91637364c33fdd49ce3cb Reviewed-by: Leander Beernaert Reviewed-by: Lars Knoll --- cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index c79f2487402..b44ec7f4359 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -180,6 +180,11 @@ macro(qt_build_tests) # Of course we always need the test module as well. find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test) + + # Set language standards after finding Core, because that's when the relevant + # feature variables are available, and the call in QtSetup is too early when building + # standalone tests, because Core was not find_package()'d yet. + qt_set_language_standards() endif() if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/auto/CMakeLists.txt")