[runtimes] Use -Wunknown-pragmas for the pragma check
authorPetr Hosek <phosek@chromium.org>
Thu, 30 May 2019 05:38:06 +0000 (05:38 +0000)
committerPetr Hosek <phosek@chromium.org>
Thu, 30 May 2019 05:38:06 +0000 (05:38 +0000)
This is a follow up to r362055, we need -Wunknown-pragmas otherwise
the check is going to succeed it the pragma isn't supported.

llvm-svn: 362057

libcxx/cmake/config-ix.cmake
libcxxabi/cmake/config-ix.cmake
libunwind/cmake/config-ix.cmake

index b2d275b..cedc767 100644 (file)
@@ -1,3 +1,4 @@
+include(CMakePushCheckState)
 include(CheckLibraryExists)
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
@@ -62,10 +63,13 @@ endif ()
 
 # Check compiler pragmas
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  cmake_push_check_state()
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
   check_c_source_compiles("
 #pragma comment(lib, \"c\")
 int main() { return 0; }
 " LIBCXX_HAS_COMMENT_LIB_PRAGMA)
+  cmake_pop_check_state()
 endif()
 
 if(NOT WIN32 OR MINGW)
index 30d2ae2..04d58fc 100644 (file)
@@ -1,3 +1,4 @@
+include(CMakePushCheckState)
 include(CheckLibraryExists)
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
@@ -51,10 +52,13 @@ endif ()
 
 # Check compiler pragmas
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  cmake_push_check_state()
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
   check_c_source_compiles("
 #pragma comment(lib, \"c\")
 int main() { return 0; }
 " LIBCXXABI_HAS_COMMENT_LIB_PRAGMA)
+  cmake_pop_check_state()
 endif()
 
 # Check compiler flags
index 2c27ecf..07a95ce 100644 (file)
@@ -1,3 +1,4 @@
+include(CMakePushCheckState)
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 include(CheckLibraryExists)
@@ -57,10 +58,13 @@ endif ()
 
 # Check compiler pragmas
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  cmake_push_check_state()
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
   check_c_source_compiles("
 #pragma comment(lib, \"c\")
 int main() { return 0; }
 " LIBUNWIND_HAS_COMMENT_LIB_PRAGMA)
+  cmake_pop_check_state()
 endif()
 
 # Check compiler flags