Skip to content

Commit e552ff7

Browse files
committed
cmake: improve the PCH support detection
1 parent 4cb34f5 commit e552ff7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,9 @@ function(ADD_PRECOMPILED_HEADER Target)
415415
set(Header ${COMMON_DIR}/Common.h)
416416

417417
# Compiler-specific PCH support
418-
if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR NACL)
418+
try_c_cxx_flag(PCH "-pch")
419+
420+
if (PCH)
419421
add_custom_command(OUTPUT "${OBJ_DIR}/${Target}.h.gch"
420422
COMMAND ${PNACLPYTHON_PREFIX2} ${CMAKE_CXX_COMPILER} ${Defs} ${Flags} -x c++-header ${Header} -o "${OBJ_DIR}/${Target}.h.gch"
421423
DEPENDS ${Header}
@@ -426,7 +428,7 @@ function(ADD_PRECOMPILED_HEADER Target)
426428
add_dependencies(${Target} ${Target}-pch)
427429

428430
# PNaCl clang doesn't support -include-pch properly
429-
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT NACL)
431+
if (NOT DAEMON_CXX_COMPILER_NAME STREQUAL "PNaCl")
430432
set_property(TARGET ${Target} APPEND PROPERTY COMPILE_OPTIONS "-include-pch;${OBJ_DIR}/${Target}.h.gch")
431433
else()
432434
set_property(TARGET ${Target} APPEND PROPERTY COMPILE_OPTIONS "-include;${OBJ_DIR}/${Target}.h;-Winvalid-pch")

0 commit comments

Comments
 (0)