diff options
Diffstat (limited to 'configure.cmake')
-rw-r--r-- | configure.cmake | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/configure.cmake b/configure.cmake index 55c2d6b73c..f6fba22731 100644 --- a/configure.cmake +++ b/configure.cmake @@ -15,6 +15,54 @@ qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev) #### Tests +# c++14 +qt_config_compile_test(cxx14 + LABEL "C++14 support" +"#if __cplusplus > 201103L +// Compiler claims to support C++14, trust it +#else +# error __cplusplus must be > 201103L (the value of C++11) +#endif + + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ + + /* END TEST: */ + return 0; +} +" + CXX_STANDARD 14 +) + +# c++17 +qt_config_compile_test(cxx17 + LABEL "C++17 support" +"#if __cplusplus > 201402L +// Compiler claims to support C++17, trust it +#else +# error __cplusplus must be > 201402L (the value for C++14) +#endif +#include <map> // https://bugs.llvm.org//show_bug.cgi?id=33117 +#include <variant> + + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +std::variant<int> v(42); +int i = std::get<int>(v); +std::visit([](const auto &) { return 1; }, v); + /* END TEST: */ + return 0; +} +" + CXX_STANDARD 17 +) + # c++2a qt_config_compile_test(cxx2a LABEL "C++2a support" @@ -33,7 +81,8 @@ int main(int argc, char **argv) /* END TEST: */ return 0; } -"# FIXME: qmake: CONFIG += c++11 c++14 c++17 c++2a +" + CXX_STANDARD 20 ) # precompile_header @@ -294,11 +343,11 @@ qt_feature("cxx11" PUBLIC ) qt_feature("cxx14" PUBLIC LABEL "C++14" - CONDITION QT_FEATURE_cxx11 AND $<COMPILE_FEATURES:cxx_std_14> + CONDITION QT_FEATURE_cxx11 AND TEST_cxx14 ) qt_feature("cxx17" PUBLIC LABEL "C++17" - CONDITION QT_FEATURE_cxx14 AND $<COMPILE_FEATURES:cxx_std_17> + CONDITION QT_FEATURE_cxx14 AND TEST_cxx17 ) qt_feature("cxx1z" PUBLIC LABEL "C++17" |