Browse Source

Compilers: protect use of __has_include

If the compiler does not have __has_include, pretend the answer is always no
Zack Galbreath 4 years ago
parent
commit
590553f322
2 changed files with 12 additions and 0 deletions
  1. 6 0
      Modules/CMakeCCompilerId.c.in
  2. 6 0
      Modules/CMakeCXXCompilerId.cpp.in

+ 6 - 0
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

+ 6 - 0
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