summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2021-06-07 18:18:29 (GMT)
committerZack Galbreath <zack.galbreath@kitware.com>2021-06-07 19:25:09 (GMT)
commit590553f32246b374853c50cf7c30af3880ac02ea (patch)
treeb3ebca5035eb33d2df0997e99b5357cfcf3dd042
parented3aad97e3d3cb27637722fabb0ae3a5611daf5c (diff)
downloadCMake-590553f32246b374853c50cf7c30af3880ac02ea.zip
CMake-590553f32246b374853c50cf7c30af3880ac02ea.tar.gz
CMake-590553f32246b374853c50cf7c30af3880ac02ea.tar.bz2
Compilers: protect use of __has_include
If the compiler does not have __has_include, pretend the answer is always no
-rw-r--r--Modules/CMakeCCompilerId.c.in6
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in6
2 files changed, 12 insertions, 0 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 75e9d1a..1f19c00 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -11,6 +11,12 @@
# define volatile
#endif
+#if !defined(__has_include)
+/* If the compiler does not have __has_include, pretend the answer is
+ always no. */
+# define __has_include(x) 0
+#endif
+
@CMAKE_C_COMPILER_ID_CONTENT@
/* Construct the string literal in pieces to prevent the source from
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index a67caba..7362a08 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -5,6 +5,12 @@
# error "A C compiler has been selected for C++."
#endif
+#if !defined(__has_include)
+/* If the compiler does not have __has_include, pretend the answer is
+ always no. */
+# define __has_include(x) 0
+#endif
+
@CMAKE_CXX_COMPILER_ID_CONTENT@
/* Construct the string literal in pieces to prevent the source from