summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeOBJCCompilerId.m.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-04-16 18:45:42 (GMT)
committerBrad King <brad.king@kitware.com>2024-04-16 19:31:36 (GMT)
commitdcbc2ef00dadf3553464419bcff5bd6dc8b2ee62 (patch)
tree0710ee516e6917e8da49a70ced8168af0c1114b7 /Modules/CMakeOBJCCompilerId.m.in
parentcf457fbf9c88dddac53ad284eafb2cffe9586cb6 (diff)
downloadCMake-dcbc2ef00dadf3553464419bcff5bd6dc8b2ee62.zip
CMake-dcbc2ef00dadf3553464419bcff5bd6dc8b2ee62.tar.gz
CMake-dcbc2ef00dadf3553464419bcff5bd6dc8b2ee62.tar.bz2
CompilerId: Clarify CUDA, HIP, ObjC, ObjC++ standard level detection
Use named constants. Regularize comparison patterns. Follow the approach from commit b9d4db7098 (CompilerId: Clarify C and C++ standard level detection, 2024-04-02).
Diffstat (limited to 'Modules/CMakeOBJCCompilerId.m.in')
-rw-r--r--Modules/CMakeOBJCCompilerId.m.in17
1 files changed, 13 insertions, 4 deletions
diff --git a/Modules/CMakeOBJCCompilerId.m.in b/Modules/CMakeOBJCCompilerId.m.in
index eff4f39..e88bb6f 100644
--- a/Modules/CMakeOBJCCompilerId.m.in
+++ b/Modules/CMakeOBJCCompilerId.m.in
@@ -20,19 +20,28 @@ char const* qnxnto = "INFO" ":" "qnxnto[]";
@CMAKE_OBJC_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_OBJC_COMPILER_ID_ERROR_FOR_TEST@
+#define C_STD_99 199901L
+#define C_STD_11 201112L
+#define C_STD_17 201710L
+#define C_STD_23 202311L
+
+#ifdef __STDC_VERSION__
+# define C_STD __STDC_VERSION__
+#endif
+
#if !defined(__STDC__)
# if defined(__ibmxl__) || defined(__IBMC__)
# define C_VERSION "90"
# else
# define C_VERSION
# endif
-#elif __STDC_VERSION__ > 201710L
+#elif C_STD > C_STD_17
# define C_VERSION "23"
-#elif __STDC_VERSION__ >= 201710L
+#elif C_STD > C_STD_11
# define C_VERSION "17"
-#elif __STDC_VERSION__ >= 201000L
+#elif C_STD > C_STD_99
# define C_VERSION "11"
-#elif __STDC_VERSION__ >= 199901L
+#elif C_STD >= C_STD_99
# define C_VERSION "99"
#else
# define C_VERSION "90"