From 7c38e6bb526ceb6a678497aaeb1e6076f7a38ba3 Mon Sep 17 00:00:00 2001 From: Tyler Date: Wed, 20 Mar 2024 15:54:36 -0600 Subject: Add CMAKE__STANDARD_LATEST variables Add a variable to indicate the latest standard known to be supported for each language: * `CMAKE_C_STANDARD_LATEST` * `CMAKE_CXX_STANDARD_LATEST` * `CMAKE_CUDA_STANDARD_LATEST` * `CMAKE_HIP_STANDARD_LATEST` * `CMAKE_OBJC_STANDARD_LATEST` * `CMAKE_OBJCXX_STANDARD_LATEST` These variables, more generally referred to as `CMAKE__STANDARD_LATEST`, are assigned an integer value which represents the minimum between the latest version of the associated language standard supported by the current compiler and the latest version supported by CMake. Add documentation for these variables in a new page called `CMAKE__STANDARD_LATEST` was added under the "Variables for Languages" section of the `cmake-variables(7)` page. Update each compiler-specific CMake script under `${CMAKE_ROOT}\Modules\Compiler` to manually define the relevant `CMAKE__STANDARD_LATEST` variable as necessary. This will require updating and maintaining as newer compiler versions become recognized by CMake. Closes: #25717 --- Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/lang-standard-latest.rst | 5 ++ Help/variable/CMAKE_LANG_STANDARD_LATEST.rst | 64 ++++++++++++++++ Modules/CMakeCCompiler.cmake.in | 1 + Modules/CMakeCUDACompiler.cmake.in | 1 + Modules/CMakeCXXCompiler.cmake.in | 1 + Modules/CMakeHIPCompiler.cmake.in | 1 + Modules/CMakeOBJCCompiler.cmake.in | 1 + Modules/CMakeOBJCXXCompiler.cmake.in | 1 + Modules/Compiler/ADSP-C.cmake | 2 + Modules/Compiler/ADSP-CXX.cmake | 2 + Modules/Compiler/ARMClang-C.cmake | 2 + Modules/Compiler/AppleClang-C.cmake | 4 + Modules/Compiler/AppleClang-CXX.cmake | 9 +++ Modules/Compiler/AppleClang-OBJC.cmake | 6 ++ Modules/Compiler/AppleClang-OBJCXX.cmake | 7 ++ Modules/Compiler/Clang-C.cmake | 9 +++ Modules/Compiler/Clang-OBJC.cmake | 6 ++ Modules/Compiler/Clang.cmake | 23 ++++++ Modules/Compiler/Cray-C.cmake | 2 + Modules/Compiler/Cray-CXX.cmake | 3 + Modules/Compiler/CrayClang-C.cmake | 2 + Modules/Compiler/CrayClang-CXX.cmake | 2 + Modules/Compiler/Fujitsu-C.cmake | 2 + Modules/Compiler/Fujitsu-CXX.cmake | 2 + Modules/Compiler/GNU-OBJC.cmake | 1 + Modules/Compiler/GNU-OBJCXX.cmake | 1 + Modules/Compiler/GNU.cmake | 17 +++++ Modules/Compiler/IBMClang-C.cmake | 3 + Modules/Compiler/IBMClang-CXX.cmake | 3 + Modules/Compiler/Intel-C.cmake | 28 ++++--- Modules/Compiler/Intel-CXX.cmake | 87 ++++++++++++---------- Modules/Compiler/IntelLLVM-C.cmake | 6 ++ Modules/Compiler/IntelLLVM-CXX.cmake | 6 ++ Modules/Compiler/LCC-C.cmake | 4 + Modules/Compiler/LCC-CXX.cmake | 6 ++ Modules/Compiler/MSVC-C.cmake | 4 + Modules/Compiler/MSVC-CXX.cmake | 12 +++ Modules/Compiler/NVHPC-C.cmake | 1 + Modules/Compiler/NVHPC-CXX.cmake | 1 + Modules/Compiler/NVIDIA.cmake | 12 +++ Modules/Compiler/OrangeC-C.cmake | 2 + Modules/Compiler/OrangeC-CXX.cmake | 2 + Modules/Compiler/PGI-C.cmake | 3 + Modules/Compiler/PGI-CXX.cmake | 4 + Modules/Compiler/SunPro-C.cmake | 4 + Modules/Compiler/SunPro-CXX.cmake | 4 + Modules/Compiler/TI-C.cmake | 5 ++ Modules/Compiler/TI-CXX.cmake | 3 + Modules/Compiler/TIClang-C.cmake | 2 + Modules/Compiler/TIClang-CXX.cmake | 2 + Modules/Compiler/Tasking-C.cmake | 2 + Modules/Compiler/Tasking-CXX.cmake | 2 + Modules/Compiler/XL-C.cmake | 3 + Modules/Compiler/XL-CXX.cmake | 3 + Modules/Compiler/XLClang-C.cmake | 3 + Modules/Compiler/XLClang-CXX.cmake | 5 ++ Tests/RunCMake/CMakeLists.txt | 10 +++ Tests/RunCMake/LanguageStandards/CMakeLists.txt | 3 + Tests/RunCMake/LanguageStandards/Inspect.cmake | 14 ++++ .../RunCMake/LanguageStandards/RunCMakeTest.cmake | 32 ++++++++ .../LanguageStandards/StdLatest-C-stdout.txt | 1 + Tests/RunCMake/LanguageStandards/StdLatest-C.c | 4 + Tests/RunCMake/LanguageStandards/StdLatest-C.cmake | 4 + .../LanguageStandards/StdLatest-CUDA-stdout.txt | 1 + .../LanguageStandards/StdLatest-CUDA.cmake | 4 + Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu | 4 + .../LanguageStandards/StdLatest-CXX-stdout.txt | 1 + .../RunCMake/LanguageStandards/StdLatest-CXX.cmake | 5 ++ Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx | 4 + .../LanguageStandards/StdLatest-HIP-stdout.txt | 1 + .../RunCMake/LanguageStandards/StdLatest-HIP.cmake | 4 + Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip | 4 + .../LanguageStandards/StdLatest-OBJC-stdout.txt | 1 + .../LanguageStandards/StdLatest-OBJC.cmake | 4 + Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m | 4 + .../LanguageStandards/StdLatest-OBJCXX-stdout.txt | 1 + .../LanguageStandards/StdLatest-OBJCXX.cmake | 4 + .../RunCMake/LanguageStandards/StdLatest-OBJCXX.mm | 4 + 79 files changed, 464 insertions(+), 50 deletions(-) create mode 100644 Help/release/dev/lang-standard-latest.rst create mode 100644 Help/variable/CMAKE_LANG_STANDARD_LATEST.rst create mode 100644 Tests/RunCMake/LanguageStandards/CMakeLists.txt create mode 100644 Tests/RunCMake/LanguageStandards/Inspect.cmake create mode 100644 Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-C.c create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-C.cmake create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake create mode 100644 Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 92da82a..8f98f8b 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -645,6 +645,7 @@ Variables for Languages /variable/CMAKE_LANG_STANDARD /variable/CMAKE_LANG_STANDARD_DEFAULT /variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES + /variable/CMAKE_LANG_STANDARD_LATEST /variable/CMAKE_LANG_STANDARD_LIBRARIES /variable/CMAKE_LANG_STANDARD_REQUIRED /variable/CMAKE_OBJC_EXTENSIONS diff --git a/Help/release/dev/lang-standard-latest.rst b/Help/release/dev/lang-standard-latest.rst new file mode 100644 index 0000000..b4713b6 --- /dev/null +++ b/Help/release/dev/lang-standard-latest.rst @@ -0,0 +1,5 @@ +lang-standard-latest +-------------------- + +* The :variable:`CMAKE__STANDARD_LATEST` variable was added to + describe the latest supported standard of language ````. diff --git a/Help/variable/CMAKE_LANG_STANDARD_LATEST.rst b/Help/variable/CMAKE_LANG_STANDARD_LATEST.rst new file mode 100644 index 0000000..3a759cf --- /dev/null +++ b/Help/variable/CMAKE_LANG_STANDARD_LATEST.rst @@ -0,0 +1,64 @@ +CMAKE__STANDARD_LATEST +----------------------------- + +.. versionadded:: 3.30 + +This variable represents the minimum between the latest version of the +standard for language ```` which is supported by the current compiler +and the latest version which is supported by CMake. Its value will be set to +one of the supported values of the corresponding :prop_tgt:`_STANDARD` +target property; see the documentation of that property for a list of +supported languages. + +See the :manual:`cmake-compile-features(7)` manual for information on compile +features and a list of supported compilers. + +.. note:: + + ``CMAKE__STANDARD_LATEST`` will never be set to a language standard + which CMake recognizes but provides no support for. Unless explicitly + stated otherwise, every value which is supported by the corresponding + :prop_tgt:`_STANDARD` target property represents a standard of + language ```` which is both recognized and supported by CMake. + +Checking for Language Standard Support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +It is possible to use the value of the ``CMAKE__STANDARD_LATEST`` +variable to check for language standard support. This can be used to, e.g., +conditionally enable optional features for a distributed library. + +When doing so, one should be careful to **not** rely on integer value +comparisons between standard levels. This is because some older standards of +a given language which are supported by CMake (e.g., C++98, represented as +``98``) will have a higher numerical value than newer standards of that same +language. + +The following code sample demonstrates how one might correctly check for +C++17 support: + +.. code-block:: cmake + + # Careful! We cannot do direct integer comparisons with + # CMAKE_CXX_STANDARD_LATEST because some earlier C++ standards (e.g., + # C++98) will have a higher numerical value than our requirement (C++17). + # + # Instead, we keep a list of unsupported C++ standards and check if + # CMAKE_CXX_STANDARD_LATEST appears in that list. + set(UNSUPPORTED_CXX_STANDARDS + 98 + 11 + 14 + ) + + list(FIND UNSUPPORTED_CXX_STANDARDS ${CMAKE_CXX_STANDARD_LATEST} UNSUPPORTED_CXX_STANDARDS_INDEX) + + if(UNSUPPORTED_CXX_STANDARDS_INDEX EQUAL -1) + # We know that the current compiler supports at least C++17. Enabling + # some optional feature... + else() + message(STATUS + "Feature X is disabled because it requires C++17, but the current " + "compiler only supports C++${CMAKE_CXX_STANDARD_LATEST}." + ) + endif() diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index df2a060..1726fe9 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -6,6 +6,7 @@ set(CMAKE_C_COMPILER_VERSION_INTERNAL "@CMAKE_C_COMPILER_VERSION_INTERNAL@") set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@") set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT@") +set(CMAKE_C_STANDARD_LATEST "@CMAKE_C_STANDARD_LATEST@") set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@") diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index 9260c64..c054e5c 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -7,6 +7,7 @@ set(CMAKE_CUDA_DEVICE_LINKER "@CMAKE_CUDA_DEVICE_LINKER@") set(CMAKE_CUDA_FATBINARY "@CMAKE_CUDA_FATBINARY@") set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CUDA_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_CUDA_EXTENSIONS_COMPUTED_DEFAULT@") +set(CMAKE_CUDA_STANDARD_LATEST "@CMAKE_CUDA_STANDARD_LATEST@") set(CMAKE_CUDA_COMPILE_FEATURES "@CMAKE_CUDA_COMPILE_FEATURES@") set(CMAKE_CUDA03_COMPILE_FEATURES "@CMAKE_CUDA03_COMPILE_FEATURES@") set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 1064e7c..2f7c3e4 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -6,6 +6,7 @@ set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "@CMAKE_CXX_COMPILER_VERSION_INTERNAL@") set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@") set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT@") +set(CMAKE_CXX_STANDARD_LATEST "@CMAKE_CXX_STANDARD_LATEST@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@") diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in index c603a4d..601ffaf 100644 --- a/Modules/CMakeHIPCompiler.cmake.in +++ b/Modules/CMakeHIPCompiler.cmake.in @@ -5,6 +5,7 @@ set(CMAKE_HIP_COMPILER_ID "@CMAKE_HIP_COMPILER_ID@") set(CMAKE_HIP_COMPILER_VERSION "@CMAKE_HIP_COMPILER_VERSION@") set(CMAKE_HIP_STANDARD_COMPUTED_DEFAULT "@CMAKE_HIP_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_HIP_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_HIP_EXTENSIONS_COMPUTED_DEFAULT@") +set(CMAKE_HIP_STANDARD_LATEST "@CMAKE_HIP_STANDARD_LATEST@") set(CMAKE_HIP_COMPILE_FEATURES "@CMAKE_HIP_COMPILE_FEATURES@") set(CMAKE_HIP98_COMPILE_FEATURES "@CMAKE_HIP03_COMPILE_FEATURES@") set(CMAKE_HIP11_COMPILE_FEATURES "@CMAKE_HIP11_COMPILE_FEATURES@") diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index a8bb0d2..fb699fc 100644 --- a/Modules/CMakeOBJCCompiler.cmake.in +++ b/Modules/CMakeOBJCCompiler.cmake.in @@ -6,6 +6,7 @@ set(CMAKE_OBJC_COMPILER_VERSION_INTERNAL "@CMAKE_OBJC_COMPILER_VERSION_INTERNAL@ set(CMAKE_OBJC_COMPILER_WRAPPER "@CMAKE_OBJC_COMPILER_WRAPPER@") set(CMAKE_OBJC_STANDARD_COMPUTED_DEFAULT "@CMAKE_OBJC_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_OBJC_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_OBJC_EXTENSIONS_COMPUTED_DEFAULT@") +set(CMAKE_OBJC_STANDARD_LATEST "@CMAKE_OBJC_STANDARD_LATEST@") set(CMAKE_OBJC_COMPILE_FEATURES "@CMAKE_OBJC_COMPILE_FEATURES@") set(CMAKE_OBJC90_COMPILE_FEATURES "@CMAKE_OBJC90_COMPILE_FEATURES@") set(CMAKE_OBJC99_COMPILE_FEATURES "@CMAKE_OBJC99_COMPILE_FEATURES@") diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in index 6a80d50..3bf12b1 100644 --- a/Modules/CMakeOBJCXXCompiler.cmake.in +++ b/Modules/CMakeOBJCXXCompiler.cmake.in @@ -6,6 +6,7 @@ set(CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL "@CMAKE_OBJCXX_COMPILER_VERSION_INTER set(CMAKE_OBJCXX_COMPILER_WRAPPER "@CMAKE_OBJCXX_COMPILER_WRAPPER@") set(CMAKE_OBJCXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_OBJCXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_OBJCXX_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_OBJCXX_EXTENSIONS_COMPUTED_DEFAULT@") +set(CMAKE_OBJCXX_STANDARD_LATEST "@CMAKE_OBJCXX_STANDARD_LATEST@") set(CMAKE_OBJCXX_COMPILE_FEATURES "@CMAKE_OBJCXX_COMPILE_FEATURES@") set(CMAKE_OBJCXX98_COMPILE_FEATURES "@CMAKE_OBJCXX98_COMPILE_FEATURES@") set(CMAKE_OBJCXX11_COMPILE_FEATURES "@CMAKE_OBJCXX11_COMPILE_FEATURES@") diff --git a/Modules/Compiler/ADSP-C.cmake b/Modules/Compiler/ADSP-C.cmake index cef3fb1..1898401 100644 --- a/Modules/Compiler/ADSP-C.cmake +++ b/Modules/Compiler/ADSP-C.cmake @@ -8,4 +8,6 @@ set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C_STANDARD_LATEST 99) + __compiler_check_default_language_standard(C 8.0.0.0 99) diff --git a/Modules/Compiler/ADSP-CXX.cmake b/Modules/Compiler/ADSP-CXX.cmake index b01cab1..e82d9fb 100644 --- a/Modules/Compiler/ADSP-CXX.cmake +++ b/Modules/Compiler/ADSP-CXX.cmake @@ -6,11 +6,13 @@ __compiler_adsp(CXX) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -c++) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -g++) set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_CXX_STANDARD_LATEST 98) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.3.0.0) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -c++11) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -c++11 -g++) set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 11) endif() __compiler_check_default_language_standard(CXX 8.0.0.0 98) diff --git a/Modules/Compiler/ARMClang-C.cmake b/Modules/Compiler/ARMClang-C.cmake index 643fdad..fce1a8e 100644 --- a/Modules/Compiler/ARMClang-C.cmake +++ b/Modules/Compiler/ARMClang-C.cmake @@ -22,6 +22,8 @@ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C_STANDARD_LATEST 11) + # Including the "${CMAKE_ROOT}/Modules/Compiler/Clang-C.cmake" script above may set several other compile option # variables which do not necessarily apply here. So, we unset those variables accordingly. unset(CMAKE_C17_STANDARD_COMPILE_OPTION) diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index d711b6e..41e7988 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -26,16 +26,20 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C_STANDARD_LATEST 11) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0) set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") + set(CMAKE_C_STANDARD_LATEST 17) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.3) set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x") set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x") + set(CMAKE_C_STANDARD_LATEST 23) endif() __compiler_check_default_language_standard(C 4.0 99 9.1 11 12.0.5 17) diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 7c97969..8a6c855 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -22,25 +22,31 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + + set(CMAKE_CXX_STANDARD_LATEST 11) endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 14) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 14) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + set(CMAKE_CXX_STANDARD_LATEST 17) elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") + set(CMAKE_CXX_STANDARD_LATEST 17) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) @@ -50,14 +56,17 @@ endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") + set(CMAKE_CXX_STANDARD_LATEST 20) elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") + set(CMAKE_CXX_STANDARD_LATEST 20) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b") set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") + set(CMAKE_CXX_STANDARD_LATEST 23) endif() __compiler_check_default_language_standard(CXX 4.0 98) diff --git a/Modules/Compiler/AppleClang-OBJC.cmake b/Modules/Compiler/AppleClang-OBJC.cmake index 8a95d26..aa02d4b 100644 --- a/Modules/Compiler/AppleClang-OBJC.cmake +++ b/Modules/Compiler/AppleClang-OBJC.cmake @@ -21,6 +21,8 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_OBJC11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_OBJC11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_OBJC_STANDARD_LATEST 11) endif() # AppleClang 10.0 was the oldest compiler available to test C17 support @@ -28,12 +30,16 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 10.0) set(CMAKE_OBJC17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_OBJC17_EXTENSION_COMPILE_OPTION "-std=gnu17") set(CMAKE_OBJC17_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_OBJC_STANDARD_LATEST 17) endif() if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 11.0.3) set(CMAKE_OBJC23_STANDARD_COMPILE_OPTION "-std=c2x") set(CMAKE_OBJC23_EXTENSION_COMPILE_OPTION "-std=gnu2x") set(CMAKE_OBJC23_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_OBJC_STANDARD_LATEST 23) endif() # AppleClang 10.0 was the oldest compiler available to test default C11 support diff --git a/Modules/Compiler/AppleClang-OBJCXX.cmake b/Modules/Compiler/AppleClang-OBJCXX.cmake index 172a343..d2573e5 100644 --- a/Modules/Compiler/AppleClang-OBJCXX.cmake +++ b/Modules/Compiler/AppleClang-OBJCXX.cmake @@ -19,25 +19,31 @@ if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_OBJCXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_OBJCXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + + set(CMAKE_OBJCXX_STANDARD_LATEST 11) endif() if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1) set(CMAKE_OBJCXX14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_OBJCXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") set(CMAKE_OBJCXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_OBJCXX_STANDARD_LATEST 14) elseif(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 5.1) # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L set(CMAKE_OBJCXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_OBJCXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") set(CMAKE_OBJCXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_OBJCXX_STANDARD_LATEST 14) endif() if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 10.0) set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + set(CMAKE_OBJCXX_STANDARD_LATEST 17) elseif (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1) set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++1z") set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") + set(CMAKE_OBJCXX_STANDARD_LATEST 17) endif() if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 8.0) @@ -47,6 +53,7 @@ endif() if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 10.0) set(CMAKE_OBJCXX20_STANDARD_COMPILE_OPTION "-std=c++2a") set(CMAKE_OBJCXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") + set(CMAKE_OBJCXX_STANDARD_LATEST 20) endif() __compiler_check_default_language_standard(OBJCXX 4.0 98) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 480a5de..c9b1669 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -33,27 +33,34 @@ if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + + set(CMAKE_C_STANDARD_LATEST 99) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + set(CMAKE_C_STANDARD_LATEST 11) elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") + set(CMAKE_C_STANDARD_LATEST 11) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") + set(CMAKE_C_STANDARD_LATEST 17) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0) set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c23") set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu23") + set(CMAKE_C_STANDARD_LATEST 23) elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0) set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x") set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x") + set(CMAKE_C_STANDARD_LATEST 23) endif() else() set(CMAKE_C90_STANDARD_COMPILE_OPTION "") @@ -74,6 +81,8 @@ else() set(CMAKE_C17_STANDARD_COMPILE_OPTION "") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "") endif() + + set(CMAKE_C_STANDARD_LATEST 17) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1) diff --git a/Modules/Compiler/Clang-OBJC.cmake b/Modules/Compiler/Clang-OBJC.cmake index 7a83b77..c374d71 100644 --- a/Modules/Compiler/Clang-OBJC.cmake +++ b/Modules/Compiler/Clang-OBJC.cmake @@ -22,18 +22,24 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_OBJC11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_OBJC11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_OBJC_STANDARD_LATEST 11) endif() if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 6.0) set(CMAKE_OBJC17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_OBJC17_EXTENSION_COMPILE_OPTION "-std=gnu17") set(CMAKE_OBJC17_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_OBJC_STANDARD_LATEST 17) endif() if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 9.0) set(CMAKE_OBJC23_STANDARD_COMPILE_OPTION "-std=c2x") set(CMAKE_OBJC23_EXTENSION_COMPILE_OPTION "-std=gnu2x") set(CMAKE_OBJC23_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_OBJC_STANDARD_LATEST 23) endif() __compiler_check_default_language_standard(OBJC 3.4 99 3.6 11) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 2452d5e..089b188 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -135,6 +135,7 @@ macro(__compiler_clang_cxx_standards lang) if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 2.1) set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "-std=c++98") set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "-std=gnu++98") + set(CMAKE_${lang}_STANDARD_LATEST 98) endif() if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1) @@ -142,19 +143,23 @@ macro(__compiler_clang_cxx_standards lang) set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++11") set(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_${lang}_STANDARD_LATEST 11) elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 2.1) set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++0x") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") + set(CMAKE_${lang}_STANDARD_LATEST 11) endif() if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.5) set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++14") set(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_${lang}_STANDARD_LATEST 14) elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") set(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_${lang}_STANDARD_LATEST 14) endif() set(_clang_version_std17 5.0) @@ -165,17 +170,21 @@ macro(__compiler_clang_cxx_standards lang) if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}") set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + set(CMAKE_${lang}_STANDARD_LATEST 17) elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.5) set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++1z") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") + set(CMAKE_${lang}_STANDARD_LATEST 17) endif() if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0) set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20") + set(CMAKE_${lang}_STANDARD_LATEST 20) elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}") set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++2a") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") + set(CMAKE_${lang}_STANDARD_LATEST 20) endif() unset(_clang_version_std17) @@ -190,9 +199,11 @@ macro(__compiler_clang_cxx_standards lang) set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++23") set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std=c++26") set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std=gnu++26") + set(CMAKE_${lang}_STANDARD_LATEST 26) elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b") set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") + set(CMAKE_${lang}_STANDARD_LATEST 23) endif() unset(_clang_version_std23) @@ -231,14 +242,18 @@ macro(__compiler_clang_cxx_standards lang) set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++latest") endif() + set(CMAKE_${lang}_STANDARD_LATEST 17) + if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std:c++latest") set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++20") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++20") + set(CMAKE_${lang}_STANDARD_LATEST 23) elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest") + set(CMAKE_${lang}_STANDARD_LATEST 20) endif() __compiler_check_default_language_standard(${lang} 3.9 14) @@ -262,6 +277,14 @@ macro(__compiler_clang_cxx_standards lang) # There is no meaningful default for this set(CMAKE_${lang}_STANDARD_DEFAULT "") + if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.0) + set(CMAKE_${lang}_STANDARD_LATEST 17) + elseif(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 18.0) + set(CMAKE_${lang}_STANDARD_LATEST 14) + elseif(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 16.0) + set(CMAKE_${lang}_STANDARD_LATEST 11) + endif() + # There are no compiler modes so we only need to test features once. # Override the default macro for this special case. Pretend that # all language standards are available so that at least compilation diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake index 9340948..51f8cc4 100644 --- a/Modules/Compiler/Cray-C.cmake +++ b/Modules/Compiler/Cray-C.cmake @@ -14,10 +14,12 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) set(CMAKE_C99_STANDARD_COMPILE_OPTION -h c99,conform) set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu) set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 99) if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5) set(CMAKE_C11_STANDARD_COMPILE_OPTION -h std=c11,conform) set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu) set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 11) endif () endif () diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake index 38c8b1e..9a40b98 100644 --- a/Modules/Compiler/Cray-CXX.cmake +++ b/Modules/Compiler/Cray-CXX.cmake @@ -11,15 +11,18 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu) set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 98) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu) set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 11) endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu) set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 14) endif () endif () diff --git a/Modules/Compiler/CrayClang-C.cmake b/Modules/Compiler/CrayClang-C.cmake index bf878fc..96e46be 100644 --- a/Modules/Compiler/CrayClang-C.cmake +++ b/Modules/Compiler/CrayClang-C.cmake @@ -27,4 +27,6 @@ set(CMAKE_C17_EXTENSION_COMPILE_OPTION -std=gnu17) set(CMAKE_C23_STANDARD_COMPILE_OPTION -std=c2x) set(CMAKE_C23_EXTENSION_COMPILE_OPTION -std=gnu2x) +set(CMAKE_C_STANDARD_LATEST 23) + __compiler_check_default_language_standard(C 15.0.0 17) diff --git a/Modules/Compiler/CrayClang-CXX.cmake b/Modules/Compiler/CrayClang-CXX.cmake index de6a53c..a61edfa 100644 --- a/Modules/Compiler/CrayClang-CXX.cmake +++ b/Modules/Compiler/CrayClang-CXX.cmake @@ -32,4 +32,6 @@ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION -std=gnu++20) set(CMAKE_CXX23_STANDARD_COMPILE_OPTION -std=c++2b) set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION -std=gnu++2b) +set(CMAKE_CXX_STANDARD_LATEST 23) + __compiler_check_default_language_standard(CXX 15.0.0 14) diff --git a/Modules/Compiler/Fujitsu-C.cmake b/Modules/Compiler/Fujitsu-C.cmake index dd31e43..0ffa82d 100644 --- a/Modules/Compiler/Fujitsu-C.cmake +++ b/Modules/Compiler/Fujitsu-C.cmake @@ -15,6 +15,8 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4) set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11) set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=gnu11) set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C_STANDARD_LATEST 11) endif() __compiler_check_default_language_standard(C 4 11) diff --git a/Modules/Compiler/Fujitsu-CXX.cmake b/Modules/Compiler/Fujitsu-CXX.cmake index 0f42196..56f16c1 100644 --- a/Modules/Compiler/Fujitsu-CXX.cmake +++ b/Modules/Compiler/Fujitsu-CXX.cmake @@ -42,6 +42,8 @@ if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 4) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION -std=c++17) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION -std=gnu++17) + + set(CMAKE_CXX_STANDARD_LATEST 17) endif() __compiler_check_default_language_standard(CXX 4 14) diff --git a/Modules/Compiler/GNU-OBJC.cmake b/Modules/Compiler/GNU-OBJC.cmake index 7eeed83..4a2cd85 100644 --- a/Modules/Compiler/GNU-OBJC.cmake +++ b/Modules/Compiler/GNU-OBJC.cmake @@ -1,5 +1,6 @@ include(Compiler/GNU) __compiler_gnu(OBJC) +__compiler_gnu_c_standards(OBJC) if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) diff --git a/Modules/Compiler/GNU-OBJCXX.cmake b/Modules/Compiler/GNU-OBJCXX.cmake index 1047b5d..e3006f2 100644 --- a/Modules/Compiler/GNU-OBJCXX.cmake +++ b/Modules/Compiler/GNU-OBJCXX.cmake @@ -1,5 +1,6 @@ include(Compiler/GNU) __compiler_gnu(OBJCXX) +__compiler_gnu_cxx_standards(OBJCXX) if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 857399c..3f705a9 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -212,9 +212,11 @@ macro(__compiler_gnu_c_standards lang) if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.5) set(CMAKE_${lang}90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_${lang}90_EXTENSION_COMPILE_OPTION "-std=gnu90") + set(CMAKE_${lang}_STANDARD_LATEST 90) elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_${lang}90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_${lang}90_EXTENSION_COMPILE_OPTION "-std=gnu89") + set(CMAKE_${lang}_STANDARD_LATEST 90) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4) @@ -222,25 +224,30 @@ macro(__compiler_gnu_c_standards lang) set(CMAKE_${lang}99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_${lang}99_EXTENSION_COMPILE_OPTION "-std=gnu99") set(CMAKE_${lang}99_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_${lang}_STANDARD_LATEST 99) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_${lang}_STANDARD_LATEST 11) elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c1x") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu1x") + set(CMAKE_${lang}_STANDARD_LATEST 11) endif() if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu17") + set(CMAKE_${lang}_STANDARD_LATEST 17) endif() if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1) set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c2x") set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu2x") + set(CMAKE_${lang}_STANDARD_LATEST 23) endif() endmacro() @@ -248,16 +255,19 @@ macro(__compiler_gnu_cxx_standards lang) if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "-std=c++98") set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "-std=gnu++98") + set(CMAKE_${lang}_STANDARD_LATEST 98) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_${lang}98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + set(CMAKE_${lang}_STANDARD_LATEST 11) elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.4) # 4.3 supports 0x variants set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++0x") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") + set(CMAKE_${lang}_STANDARD_LATEST 11) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.8.1) @@ -267,9 +277,11 @@ macro(__compiler_gnu_cxx_standards lang) if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.9) set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++14") + set(CMAKE_${lang}_STANDARD_LATEST 14) elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.8) set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") + set(CMAKE_${lang}_STANDARD_LATEST 14) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 5.0) @@ -279,9 +291,11 @@ macro(__compiler_gnu_cxx_standards lang) if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 8.0) set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + set(CMAKE_${lang}_STANDARD_LATEST 17) elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 5.1) set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++1z") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") + set(CMAKE_${lang}_STANDARD_LATEST 17) endif() if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 11.1) @@ -289,13 +303,16 @@ macro(__compiler_gnu_cxx_standards lang) set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20") set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++23") set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++23") + set(CMAKE_${lang}_STANDARD_LATEST 23) elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++2a") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") + set(CMAKE_${lang}_STANDARD_LATEST 20) endif() if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0) set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std=c++26") set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std=gnu++26") + set(CMAKE_${lang}_STANDARD_LATEST 26) endif() endmacro() diff --git a/Modules/Compiler/IBMClang-C.cmake b/Modules/Compiler/IBMClang-C.cmake index b69b1b8..fde6a3b 100644 --- a/Modules/Compiler/IBMClang-C.cmake +++ b/Modules/Compiler/IBMClang-C.cmake @@ -23,8 +23,11 @@ set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") +set(CMAKE_C_STANDARD_LATEST 11) + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0) set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") + set(CMAKE_C_STANDARD_LATEST 17) endif () __compiler_check_default_language_standard(C 17.1.0 17) diff --git a/Modules/Compiler/IBMClang-CXX.cmake b/Modules/Compiler/IBMClang-CXX.cmake index be9b525..ec97381 100644 --- a/Modules/Compiler/IBMClang-CXX.cmake +++ b/Modules/Compiler/IBMClang-CXX.cmake @@ -26,6 +26,8 @@ set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") +set(CMAKE_CXX_STANDARD_LATEST 14) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") @@ -33,6 +35,7 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0) set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b") set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") + set(CMAKE_CXX_STANDARD_LATEST 23) endif() __compiler_check_default_language_standard(CXX 17.1.0 17) diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 9884b58..bfe5f07 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -19,12 +19,6 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") set(CMAKE_C_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl") - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0) - set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11") - set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) - endif() - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-Qstd=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-Qstd=c89") @@ -32,18 +26,20 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_C99_STANDARD_COMPILE_OPTION "-Qstd=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-Qstd=c99") set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 99) + endif() + + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 11) endif() else() set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) - set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") - set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) - endif() - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") @@ -51,6 +47,14 @@ else() set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 99) + endif() + + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 11) endif() endif() diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 7666b2d..f9e3e7a 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -18,57 +18,70 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl") set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0) - set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd=c++20") - set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd=c++20") - endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) - set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17") - set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++11") + else() + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++0x") + endif() + + set(CMAKE_CXX_STANDARD_LATEST 11) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14") + set(CMAKE_CXX_STANDARD_LATEST 14) endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++11") - elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++0x") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17") + set(CMAKE_CXX_STANDARD_LATEST 17) endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") - set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0) + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd=c++20") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd=c++20") + set(CMAKE_CXX_STANDARD_LATEST 20) endif() else() set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0.20190206) - set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20") - set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") - endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) - set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") - set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + else() + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") + endif() + + set(CMAKE_CXX_STANDARD_LATEST 11) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0) - set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX_STANDARD_LATEST 14) elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX_STANDARD_LATEST 14) endif() # Intel 15.0.2 accepts c++14 instead of c++1y, but not gnu++14 @@ -79,22 +92,20 @@ else() set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0) - set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") - elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + set(CMAKE_CXX_STANDARD_LATEST 17) endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") - set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0.20190206) + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") + set(CMAKE_CXX_STANDARD_LATEST 20) endif() endif() diff --git a/Modules/Compiler/IntelLLVM-C.cmake b/Modules/Compiler/IntelLLVM-C.cmake index f783d81..4da4dfb 100644 --- a/Modules/Compiler/IntelLLVM-C.cmake +++ b/Modules/Compiler/IntelLLVM-C.cmake @@ -42,9 +42,12 @@ if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") + set(CMAKE_C_STANDARD_LATEST 17) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1.0) set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x") set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x") + set(CMAKE_C_STANDARD_LATEST 23) endif() else() set(CMAKE_C90_STANDARD_COMPILE_OPTION "-Qstd:c90") @@ -59,9 +62,12 @@ else() set(CMAKE_C17_STANDARD_COMPILE_OPTION "-Qstd:c17") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-Qstd:c17") + set(CMAKE_C_STANDARD_LATEST 17) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1.0) set(CMAKE_C23_STANDARD_COMPILE_OPTION "-Qstd:c2x") set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-Qstd:c2x") + set(CMAKE_C_STANDARD_LATEST 23) endif() endif() diff --git a/Modules/Compiler/IntelLLVM-CXX.cmake b/Modules/Compiler/IntelLLVM-CXX.cmake index bd92139..989a1d4 100644 --- a/Modules/Compiler/IntelLLVM-CXX.cmake +++ b/Modules/Compiler/IntelLLVM-CXX.cmake @@ -47,9 +47,12 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") + set(CMAKE_CXX_STANDARD_LATEST 20) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0) set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b") set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") + set(CMAKE_CXX_STANDARD_LATEST 23) endif() else() set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") @@ -67,9 +70,12 @@ else() set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd:c++20") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd:c++20") + set(CMAKE_CXX_STANDARD_LATEST 20) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0) set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-Qstd:c++2b") set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-Qstd:c++2b") + set(CMAKE_CXX_STANDARD_LATEST 23) endif() endif() diff --git a/Modules/Compiler/LCC-C.cmake b/Modules/Compiler/LCC-C.cmake index 52c3bf3..01e99d3 100644 --- a/Modules/Compiler/LCC-C.cmake +++ b/Modules/Compiler/LCC-C.cmake @@ -22,15 +22,19 @@ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C_STANDARD_LATEST 99) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.20) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 11) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.26) set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") + set(CMAKE_C_STANDARD_LATEST 17) endif() __compiler_check_default_language_standard(C 1.17 89 1.23 99 1.26 17) diff --git a/Modules/Compiler/LCC-CXX.cmake b/Modules/Compiler/LCC-CXX.cmake index 385947a..22f2cc3 100644 --- a/Modules/Compiler/LCC-CXX.cmake +++ b/Modules/Compiler/LCC-CXX.cmake @@ -18,26 +18,32 @@ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_CXX_STANDARD_LATEST 98) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.20) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 11) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.21) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 14) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.24) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + set(CMAKE_CXX_STANDARD_LATEST 17) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.26) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") + set(CMAKE_CXX_STANDARD_LATEST 20) endif() __compiler_check_default_language_standard(CXX 1.19 98 1.20 11 1.21 14 1.24 17 1.26 20) diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake index 6bf6b4e..d7fbf9f 100644 --- a/Modules/Compiler/MSVC-C.cmake +++ b/Modules/Compiler/MSVC-C.cmake @@ -14,12 +14,15 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std:c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std:c11") + set(CMAKE_C_STANDARD_LATEST 11) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28) set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std:c17") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std:c17") + set(CMAKE_C_STANDARD_LATEST 17) else() # Special case for 19.27 (VS 16.7): C11 has partial support. macro(cmake_record_c_compile_features) @@ -41,6 +44,7 @@ else() set(CMAKE_C99_EXTENSION_COMPILE_OPTION "") set(CMAKE_C11_STANDARD_COMPILE_OPTION "") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") + set(CMAKE_C_STANDARD_LATEST 11) # There is no meaningful default for this set(CMAKE_C_STANDARD_DEFAULT "") diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 79cd2e0..2243a14 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -30,14 +30,18 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest") endif() + set(CMAKE_CXX_STANDARD_LATEST 17) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30129) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++20") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++20") set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std:c++latest") + set(CMAKE_CXX_STANDARD_LATEST 23) elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest") + set(CMAKE_CXX_STANDARD_LATEST 20) endif() __compiler_check_default_language_standard(CXX 19.0 14) @@ -57,6 +61,14 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0) + set(CMAKE_CXX_STANDARD_LATEST 17) + elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0) + set(CMAKE_CXX_STANDARD_LATEST 14) + else() + set(CMAKE_CXX_STANDARD_LATEST 11) + endif() + # There is no meaningful default for this set(CMAKE_CXX_STANDARD_DEFAULT "") diff --git a/Modules/Compiler/NVHPC-C.cmake b/Modules/Compiler/NVHPC-C.cmake index 9295abd..3838ebd 100644 --- a/Modules/Compiler/NVHPC-C.cmake +++ b/Modules/Compiler/NVHPC-C.cmake @@ -7,6 +7,7 @@ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 20.11) set(CMAKE_C17_STANDARD_COMPILE_OPTION -std=c17) set(CMAKE_C17_EXTENSION_COMPILE_OPTION -std=gnu17) + set(CMAKE_C_STANDARD_LATEST 17) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07) diff --git a/Modules/Compiler/NVHPC-CXX.cmake b/Modules/Compiler/NVHPC-CXX.cmake index 59ba7bf..0d804f4 100644 --- a/Modules/Compiler/NVHPC-CXX.cmake +++ b/Modules/Compiler/NVHPC-CXX.cmake @@ -7,6 +7,7 @@ set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.11) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION -std=c++20) set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION -std=gnu++20) + set(CMAKE_CXX_STANDARD_LATEST 20) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07) diff --git a/Modules/Compiler/NVIDIA.cmake b/Modules/Compiler/NVIDIA.cmake index a126c57..21e71cc 100644 --- a/Modules/Compiler/NVIDIA.cmake +++ b/Modules/Compiler/NVIDIA.cmake @@ -17,6 +17,8 @@ macro(__compiler_nvidia_cxx_standards lang) set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "") + set(CMAKE_${lang}_STANDARD_LATEST 11) + if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 9.0) if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017) set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14") @@ -25,12 +27,15 @@ macro(__compiler_nvidia_cxx_standards lang) set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "") set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "") endif() + + set(CMAKE_${lang}_STANDARD_LATEST 14) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0) if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.11.25505) set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=c++17") + set(CMAKE_${lang}_STANDARD_LATEST 17) endif() endif() @@ -38,6 +43,7 @@ macro(__compiler_nvidia_cxx_standards lang) if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.11.25505) set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=c++20") + set(CMAKE_${lang}_STANDARD_LATEST 20) endif() endif() else() @@ -47,21 +53,27 @@ macro(__compiler_nvidia_cxx_standards lang) set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=c++11") + set(CMAKE_${lang}_STANDARD_LATEST 11) + if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 9.0) set(CMAKE_${lang}03_STANDARD_COMPILE_OPTION "-std=c++03") set(CMAKE_${lang}03_EXTENSION_COMPILE_OPTION "-std=c++03") set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=c++14") + + set(CMAKE_${lang}_STANDARD_LATEST 14) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0) set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=c++17") + set(CMAKE_${lang}_STANDARD_LATEST 17) endif() if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=c++20") + set(CMAKE_${lang}_STANDARD_LATEST 20) endif() endif() diff --git a/Modules/Compiler/OrangeC-C.cmake b/Modules/Compiler/OrangeC-C.cmake index 15a6476..f0dfcd1 100644 --- a/Modules/Compiler/OrangeC-C.cmake +++ b/Modules/Compiler/OrangeC-C.cmake @@ -15,6 +15,8 @@ set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11) set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=c11) set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C_STANDARD_LATEST 11) + __compiler_orangec(C) #- 6.38 is the earliest version which version info is available in the preprocessor __compiler_check_default_language_standard(C 6.38 11) diff --git a/Modules/Compiler/OrangeC-CXX.cmake b/Modules/Compiler/OrangeC-CXX.cmake index 3f9d59c..575c09d 100644 --- a/Modules/Compiler/OrangeC-CXX.cmake +++ b/Modules/Compiler/OrangeC-CXX.cmake @@ -20,6 +20,8 @@ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14") set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_CXX_STANDARD_LATEST 14) + __compiler_orangec(CXX) #- 6.38 is the earliest version which version info is available in the preprocessor __compiler_check_default_language_standard(CXX 6.38 14) diff --git a/Modules/Compiler/PGI-C.cmake b/Modules/Compiler/PGI-C.cmake index c39dbe5..798fc84 100644 --- a/Modules/Compiler/PGI-C.cmake +++ b/Modules/Compiler/PGI-C.cmake @@ -10,10 +10,13 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10) set(CMAKE_C99_STANDARD_COMPILE_OPTION -c99) set(CMAKE_C99_EXTENSION_COMPILE_OPTION -c99) set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C_STANDARD_LATEST 99) if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.3) set(CMAKE_C11_STANDARD_COMPILE_OPTION -c11) set(CMAKE_C11_EXTENSION_COMPILE_OPTION -c11) set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 11) endif () endif () diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake index 1279c19..972e43a 100644 --- a/Modules/Compiler/PGI-CXX.cmake +++ b/Modules/Compiler/PGI-CXX.cmake @@ -7,19 +7,23 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions) set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 98) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION --c++03) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --c++03 --gnu_extensions) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions) set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 11) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.7) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION --c++14 --gnu_extensions) set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 14) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions) + set(CMAKE_CXX_STANDARD_LATEST 17) endif() endif() endif() diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index b06719d..7b4478c 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -52,11 +52,15 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=c11") set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C_STANDARD_LATEST 11) elseif (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.11) set(CMAKE_C90_STANDARD_COMPILE_OPTION "") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "") set(CMAKE_C99_STANDARD_COMPILE_OPTION "-xc99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-xc99") + + set(CMAKE_C_STANDARD_LATEST 99) endif() __compiler_check_default_language_standard(C 5.11 90 5.14 11) diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index f835f2d..1db6aa7 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -54,14 +54,18 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1) + set(CMAKE_CXX_STANDARD_LATEST 11) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.14) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX_STANDARD_LATEST 14) endif() else() set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-library=stlport4") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-library=stlport4") set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1) + set(CMAKE_CXX_STANDARD_LATEST 98) endif() __compiler_check_default_language_standard(CXX 1 98) diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index bd88989..7f3b67c 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -34,18 +34,23 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_$ set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi") + set(CMAKE_C_STANDARD_LATEST 99) + if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID} AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}") set(CMAKE_C11_STANDARD_COMPILE_OPTION "--c11" "--strict_ansi") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--c11" "--relaxed_ansi") + set(CMAKE_C_STANDARD_LATEST 11) + endif() else() set(CMAKE_C90_STANDARD_COMPILE_OPTION "--strict_ansi") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--relaxed_ansi") + set(CMAKE_C_STANDARD_LATEST 90) endif() diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 4b6efcd..c904239 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -39,16 +39,19 @@ if(DEFINED __COMPILER_TI_CXX14_VERSION AND set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "--c++14" "--strict_ansi") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "--c++14" "--relaxed_ansi") + set(CMAKE_CXX_STANDARD_LATEST 14) elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_CXX03_VERSION}") set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--c++03" "--strict_ansi") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--c++03" "--relaxed_ansi") + set(CMAKE_CXX_STANDARD_LATEST 98) else() set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--strict_ansi") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--relaxed_ansi") + set(CMAKE_CXX_STANDARD_LATEST 98) endif() diff --git a/Modules/Compiler/TIClang-C.cmake b/Modules/Compiler/TIClang-C.cmake index 30e6b5d..b6ce3dc 100644 --- a/Modules/Compiler/TIClang-C.cmake +++ b/Modules/Compiler/TIClang-C.cmake @@ -22,6 +22,8 @@ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C_STANDARD_LATEST 11) + # Including the "${CMAKE_ROOT}/Modules/Compiler/Clang-C.cmake" script above may set several other compile option # variables which do not necessarily apply here. So, we unset those variables accordingly. unset(CMAKE_C17_STANDARD_COMPILE_OPTION) diff --git a/Modules/Compiler/TIClang-CXX.cmake b/Modules/Compiler/TIClang-CXX.cmake index 4fb2d70..e1367df 100644 --- a/Modules/Compiler/TIClang-CXX.cmake +++ b/Modules/Compiler/TIClang-CXX.cmake @@ -24,6 +24,8 @@ set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") +set(CMAKE_CXX_STANDARD_LATEST 17) + # Including the "${CMAKE_ROOT}/Modules/Compiler/Clang-CXX.cmake" script above may set several other compile option # variables which do not necessarily apply here. So, we unset those variables accordingly. unset(CMAKE_CXX20_STANDARD_COMPILE_OPTION) diff --git a/Modules/Compiler/Tasking-C.cmake b/Modules/Compiler/Tasking-C.cmake index 0ea3cd2..938f46e 100644 --- a/Modules/Compiler/Tasking-C.cmake +++ b/Modules/Compiler/Tasking-C.cmake @@ -10,6 +10,8 @@ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--iso=99" " ") set(CMAKE_C11_STANDARD_COMPILE_OPTION "--iso=11" "--strict") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--iso=11" " ") +set(CMAKE_C_STANDARD_LATEST 11) + if(CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "TriCore") if(CMAKE_TASKING_TOOLSET STREQUAL "SmartCode") __compiler_check_default_language_standard(C 10.1 11) diff --git a/Modules/Compiler/Tasking-CXX.cmake b/Modules/Compiler/Tasking-CXX.cmake index 635104c..20e007f 100644 --- a/Modules/Compiler/Tasking-CXX.cmake +++ b/Modules/Compiler/Tasking-CXX.cmake @@ -12,6 +12,8 @@ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "--c++=11" " ") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "--c++=14" "--strict") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "--c++=14" " ") +set(CMAKE_CXX_STANDARD_LATEST 14) + if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "TriCore") if(CMAKE_TASKING_TOOLSET STREQUAL "SmartCode") __compiler_check_default_language_standard(CXX 10.1 14) diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 2077bda..d14ac85 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -13,10 +13,13 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99") set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C_STANDARD_LATEST 99) if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C_STANDARD_LATEST 11) endif () endif() diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 41e3e11..57bd5a9 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -24,10 +24,13 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) # compiler mode for the corresponding standard. set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 11) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.1.0 AND CMAKE_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-qlanglvl=extended1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y") set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX_STANDARD_LATEST 14) endif() endif () diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake index 1668a4d..7ca76e4 100644 --- a/Modules/Compiler/XLClang-C.cmake +++ b/Modules/Compiler/XLClang-C.cmake @@ -12,11 +12,14 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif () + + set(CMAKE_C_STANDARD_LATEST 11) endif() __compiler_check_default_language_standard(C 13.1.1 99) diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index 02638c7..b324987 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -10,12 +10,17 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX_STANDARD_LATEST 11) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX_STANDARD_LATEST 14) endif () if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.1.0) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9e85179..005bd17 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -440,6 +440,16 @@ add_RunCMake_test(GoogleTest # Note: does not actually depend on Google Test ) add_RunCMake_test(Graphviz) add_RunCMake_test(Languages) + +add_RunCMake_test(LanguageStandards + -DCMake_NO_C_STANDARD=${CMake_NO_C_STANDARD} + -DCMake_NO_CXX_STANDARD=${CMake_NO_CXX_STANDARD} + -DCMake_TEST_CUDA=${CMake_TEST_CUDA} + -DCMake_TEST_HIP=${CMake_TEST_HIP} + -DCMake_TEST_OBJC=${CMake_TEST_OBJC} +) +set_property(TEST RunCMake.LanguageStandards APPEND PROPERTY LABELS "CUDA" "HIP") + add_RunCMake_test(LinkItemValidation) add_RunCMake_test(LinkStatic) if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|Fujitsu|FujitsuClang)$") diff --git a/Tests/RunCMake/LanguageStandards/CMakeLists.txt b/Tests/RunCMake/LanguageStandards/CMakeLists.txt new file mode 100644 index 0000000..94e43ba --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.29) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/LanguageStandards/Inspect.cmake b/Tests/RunCMake/LanguageStandards/Inspect.cmake new file mode 100644 index 0000000..b0f2e60 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/Inspect.cmake @@ -0,0 +1,14 @@ +enable_language(C) +enable_language(CXX) + +set(info "") +foreach(var + CMAKE_C_STANDARD_DEFAULT + CMAKE_CXX_STANDARD_DEFAULT + ) + if(DEFINED ${var}) + string(APPEND info "set(${var} \"${${var}}\")\n") + endif() +endforeach() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}") diff --git a/Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake b/Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake new file mode 100644 index 0000000..bc9dfd4 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake @@ -0,0 +1,32 @@ +include(RunCMake) + +# Detect information from the toolchain: +# - CMAKE_C_STANDARD_DEFAULT +# - CMAKE_CXX_STANDARD_DEFAULT +run_cmake(Inspect) +include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") + +function(run_StdLatest lang) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/StdLatest-${lang}-build) + run_cmake(StdLatest-${lang}) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(StdLatest-${lang}-build ${CMAKE_COMMAND} --build . --config Debug) +endfunction() + +if(NOT CMake_NO_C_STANDARD AND DEFINED CMAKE_C_STANDARD_DEFAULT) + run_StdLatest(C) +endif() +if(NOT CMake_NO_CXX_STANDARD AND DEFINED CMAKE_CXX_STANDARD_DEFAULT) + run_StdLatest(CXX) +endif() +if(CMake_TEST_CUDA) + run_StdLatest(CUDA) +endif() +if(CMake_TEST_HIP) + run_StdLatest(HIP) +endif() +if(CMake_TEST_OBJC) + run_StdLatest(OBJC) + run_StdLatest(OBJCXX) +endif() diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt new file mode 100644 index 0000000..57aad4d --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_C_STANDARD_LATEST='[0-9][0-9]' diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-C.c b/Tests/RunCMake/LanguageStandards/StdLatest-C.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-C.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-C.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-C.cmake new file mode 100644 index 0000000..54f5a19 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-C.cmake @@ -0,0 +1,4 @@ +enable_language(C) +message(STATUS "CMAKE_C_STANDARD_LATEST='${CMAKE_C_STANDARD_LATEST}'") +add_executable(StdLatest StdLatest-C.c) +target_compile_features(StdLatest PRIVATE c_std_${CMAKE_C_STANDARD_LATEST}) diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt new file mode 100644 index 0000000..207541a --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_CUDA_STANDARD_LATEST='[0-9][0-9]' diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake new file mode 100644 index 0000000..496abb0 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake @@ -0,0 +1,4 @@ +enable_language(CUDA) +message(STATUS "CMAKE_CUDA_STANDARD_LATEST='${CMAKE_CUDA_STANDARD_LATEST}'") +add_executable(StdLatest StdLatest-CUDA.cu) +target_compile_features(StdLatest PRIVATE cuda_std_${CMAKE_CUDA_STANDARD_LATEST}) diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt new file mode 100644 index 0000000..db83723 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_CXX_STANDARD_LATEST='[0-9][0-9]' diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake new file mode 100644 index 0000000..34aba55 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) # In case C++20 or higher is the latest. +message(STATUS "CMAKE_CXX_STANDARD_LATEST='${CMAKE_CXX_STANDARD_LATEST}'") +add_executable(StdLatest StdLatest-CXX.cxx) +target_compile_features(StdLatest PRIVATE cxx_std_${CMAKE_CXX_STANDARD_LATEST}) diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt new file mode 100644 index 0000000..681ea9e --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_HIP_STANDARD_LATEST='[0-9][0-9]' diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake new file mode 100644 index 0000000..4eaa56c --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake @@ -0,0 +1,4 @@ +enable_language(HIP) +message(STATUS "CMAKE_HIP_STANDARD_LATEST='${CMAKE_HIP_STANDARD_LATEST}'") +add_executable(StdLatest StdLatest-HIP.hip) +target_compile_features(StdLatest PRIVATE hip_std_${CMAKE_HIP_STANDARD_LATEST}) diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt new file mode 100644 index 0000000..577c126 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_OBJC_STANDARD_LATEST='[0-9][0-9]' diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake new file mode 100644 index 0000000..6d05ab6 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake @@ -0,0 +1,4 @@ +enable_language(OBJC) +message(STATUS "CMAKE_OBJC_STANDARD_LATEST='${CMAKE_OBJC_STANDARD_LATEST}'") +add_executable(StdLatest StdLatest-OBJC.m) +set_property(TARGET StdLatest PROPERTY OBJC_STANDARD "${CMAKE_OBJC_STANDARD_LATEST}") diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt new file mode 100644 index 0000000..0c5567b --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_OBJCXX_STANDARD_LATEST='[0-9][0-9]' diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake new file mode 100644 index 0000000..c7418d0 --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake @@ -0,0 +1,4 @@ +enable_language(OBJCXX) +message(STATUS "CMAKE_OBJCXX_STANDARD_LATEST='${CMAKE_OBJCXX_STANDARD_LATEST}'") +add_executable(StdLatest StdLatest-OBJCXX.mm) +set_property(TARGET StdLatest PROPERTY OBJCXX_STANDARD "${CMAKE_OBJCXX_STANDARD_LATEST}") diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} -- cgit v0.12