Browse Source

PCH: Do not add #pragma system_header for Xcode generator

Fixes: #20039
Cristian Adam 6 years ago
parent
commit
df8372da09
2 changed files with 6 additions and 2 deletions
  1. 3 1
      Modules/Compiler/Clang.cmake
  2. 3 1
      Modules/Compiler/GNU.cmake

+ 3 - 1
Modules/Compiler/Clang.cmake

@@ -98,7 +98,9 @@ else()
     )
 
     set(CMAKE_PCH_EXTENSION .pch)
-    set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
+    if (NOT CMAKE_GENERATOR MATCHES "Xcode")
+      set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
+    endif()
     set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE>)
     set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
   endmacro()

+ 3 - 1
Modules/Compiler/GNU.cmake

@@ -111,7 +111,9 @@ macro(__compiler_gnu lang)
   list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
 
   set(CMAKE_PCH_EXTENSION .gch)
-  set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header")
+  if (NOT CMAKE_GENERATOR MATCHES "Xcode")
+    set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header")
+  endif()
   set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -include <PCH_HEADER>)
   set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -x ${__pch_header_${lang}} -include <PCH_HEADER>)
 endmacro()