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 <leander.beernaert@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Alexandru Croitor 2020-02-18 10:59:11 +01:00
parent 5fa2fc61c9
commit 4ee289d2d8

View File

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