From 590553f32246b374853c50cf7c30af3880ac02ea Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Mon, 7 Jun 2021 18:18:29 +0000 Subject: Compilers: protect use of __has_include If the compiler does not have __has_include, pretend the answer is always no --- Modules/CMakeCCompilerId.c.in | 6 ++++++ Modules/CMakeCXXCompilerId.cpp.in | 6 ++++++ 2 files changed, 12 insertions(+) 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 -- cgit v0.12