Skip to content

Commit

Permalink
CMake: Fix single standalone tests to use same Qt C++ language std
Browse files Browse the repository at this point in the history
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
Pick-to: 6.2 6.3 6.4
Reviewed-by: Oliver Wolff <[email protected]>
Reviewed-by: Jörg Bornemann <[email protected]>
  • Loading branch information
alcroito committed Aug 3, 2022
1 parent 41c4f9a commit effd6f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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().
Expand Down

0 comments on commit effd6f6

Please sign in to comment.