diff options
author | Brad King <brad.king@kitware.com> | 2021-06-14 13:48:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-06-14 13:49:22 (GMT) |
commit | 6b218d2e267c271000103bfeeca319cab8a90e3e (patch) | |
tree | c87fab1d844ac5bb33370f67deda641043d46152 | |
parent | 13b40c1ea2bfd35eb81def5c91480b306a22504a (diff) | |
parent | e8dc95ae1ec0f0ded781b7b36f3117e499502273 (diff) | |
download | CMake-6b218d2e267c271000103bfeeca319cab8a90e3e.zip CMake-6b218d2e267c271000103bfeeca319cab8a90e3e.tar.gz CMake-6b218d2e267c271000103bfeeca319cab8a90e3e.tar.bz2 |
Merge topic 'objc-std-17-23'
e8dc95ae1e ObjectiveC: Add C17 and C23 support
Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !6219
-rw-r--r-- | Help/release/dev/objc-std-17-23.rst | 4 | ||||
-rw-r--r-- | Modules/CMakeOBJCCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeOBJCCompilerId.m.in | 4 | ||||
-rw-r--r-- | Modules/Compiler/AppleClang-OBJC.cmake | 16 | ||||
-rw-r--r-- | Modules/Compiler/Clang-OBJC.cmake | 12 | ||||
-rw-r--r-- | Source/cmStandardLevelResolver.cxx | 5 |
6 files changed, 40 insertions, 3 deletions
diff --git a/Help/release/dev/objc-std-17-23.rst b/Help/release/dev/objc-std-17-23.rst new file mode 100644 index 0000000..5aba395 --- /dev/null +++ b/Help/release/dev/objc-std-17-23.rst @@ -0,0 +1,4 @@ +objc-std-17-23 +-------------- + +* :prop_tgt:`OBJC_STANDARD` gained support for C17 and C23. diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index 608adce..ab67bf3 100644 --- a/Modules/CMakeOBJCCompiler.cmake.in +++ b/Modules/CMakeOBJCCompiler.cmake.in @@ -9,6 +9,8 @@ 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@") set(CMAKE_OBJC11_COMPILE_FEATURES "@CMAKE_OBJC11_COMPILE_FEATURES@") +set(CMAKE_OBJC17_COMPILE_FEATURES "@CMAKE_OBJC17_COMPILE_FEATURES@") +set(CMAKE_OBJC23_COMPILE_FEATURES "@CMAKE_OBJC23_COMPILE_FEATURES@") set(CMAKE_OBJC_PLATFORM_ID "@CMAKE_OBJC_PLATFORM_ID@") set(CMAKE_OBJC_SIMULATE_ID "@CMAKE_OBJC_SIMULATE_ID@") diff --git a/Modules/CMakeOBJCCompilerId.m.in b/Modules/CMakeOBJCCompilerId.m.in index 2b8aa30..418fd48 100644 --- a/Modules/CMakeOBJCCompilerId.m.in +++ b/Modules/CMakeOBJCCompilerId.m.in @@ -27,6 +27,10 @@ char const* qnxnto = "INFO" ":" "qnxnto[]"; # else # define C_DIALECT # endif +#elif __STDC_VERSION__ > 201710L +# define C_DIALECT "23" +#elif __STDC_VERSION__ >= 201710L +# define C_DIALECT "17" #elif __STDC_VERSION__ >= 201000L # define C_DIALECT "11" #elif __STDC_VERSION__ >= 199901L diff --git a/Modules/Compiler/AppleClang-OBJC.cmake b/Modules/Compiler/AppleClang-OBJC.cmake index d4eab4f..f40c396 100644 --- a/Modules/Compiler/AppleClang-OBJC.cmake +++ b/Modules/Compiler/AppleClang-OBJC.cmake @@ -23,4 +23,18 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON) endif() -__compiler_check_default_language_standard(OBJC 4.0 99) +# AppleClang 10.0 was the oldest compiler available to test C17 support +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) +endif() + +if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 11.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) +endif() + +# AppleClang 10.0 was the oldest compiler available to test default C11 support +__compiler_check_default_language_standard(OBJC 4.0 99 10.0 11) diff --git a/Modules/Compiler/Clang-OBJC.cmake b/Modules/Compiler/Clang-OBJC.cmake index 19179e3..7a83b77 100644 --- a/Modules/Compiler/Clang-OBJC.cmake +++ b/Modules/Compiler/Clang-OBJC.cmake @@ -24,4 +24,16 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON) 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) +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) +endif() + __compiler_check_default_language_standard(OBJC 3.4 99 3.6 11) diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx index 73d0fed..37ed4c1 100644 --- a/Source/cmStandardLevelResolver.cxx +++ b/Source/cmStandardLevelResolver.cxx @@ -322,8 +322,9 @@ std::unordered_map<std::string, StanardLevelComputer> StandardComputerMapping = "CUDA", std::vector<int>{ 03, 11, 14, 17, 20, 23 }, std::vector<std::string>{ "03", "11", "14", "17", "20", "23" } } }, { "OBJC", - StanardLevelComputer{ "OBJC", std::vector<int>{ 90, 99, 11 }, - std::vector<std::string>{ "90", "99", "11" } } }, + StanardLevelComputer{ + "OBJC", std::vector<int>{ 90, 99, 11, 17, 23 }, + std::vector<std::string>{ "90", "99", "11", "17", "23" } } }, { "OBJCXX", StanardLevelComputer{ "OBJCXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 }, |