summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-11 14:44:12 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-12 11:41:32 +0100
commit5804473578b87f8a674eb230ee059851f6a7aaaa (patch)
treeee0059a6129415001a62da60a98580c0d6a60d68 /cmake/QtBuild.cmake
parentd2419b0d8c449bc60bc7abad3dab129dd4e8a2d0 (diff)
CMake: Propagate minimum required C++ standard to consumers of Qt
Aka the version of C++ that needs to be supported when compiling applications that use Qt headers (C++17 at the moment). Change-Id: I64dec297e8329f31b1d9864f216a95782049ed06 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake7
1 files changed, 7 insertions, 0 deletions
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.