summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtBaseGlobalTargets.cmake4
-rw-r--r--cmake/QtBuild.cmake7
2 files changed, 11 insertions, 0 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index 32f0fa8c5f..6e047f59ca 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -200,6 +200,10 @@ target_include_directories(GlobalConfigPrivate INTERFACE
)
add_library(Qt::GlobalConfigPrivate ALIAS GlobalConfigPrivate)
+# Propagate minimum C++ 17 via Platform to Qt consumers (apps), after the global features
+# are computed.
+qt_set_language_standards_interface_compile_features(Platform)
+
# defines PlatformCommonInternal PlatformModuleInternal PlatformPluginInternal PlatformToolInternal
include(QtInternalTargets)
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index af8cc6c482..2f5215c1bf 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -4075,6 +4075,13 @@ function(qt_set_language_standards)
endif()
endfunction()
+function(qt_set_language_standards_interface_compile_features target)
+ # Regardless of which C++ standard is used to build Qt itself, require C++17 when building
+ # Qt applications using CMake (because the Qt header files use C++17 features).
+ set(cpp_feature "cxx_std_17")
+ target_compile_features("${target}" INTERFACE ${cpp_feature})
+endfunction()
+
function(qt_enable_msvc_cplusplus_define target visibility)
# For MSVC we need to explicitly pass -Zc:__cplusplus to get correct __cplusplus.
# Check qt_config_compile_test for more info.