Fixed building of PCH using Clang compiler.

Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
This commit is contained in:
Vitaly Zaitsev 2019-05-18 20:47:23 +02:00 committed by John Preston
parent 9a4fdb1530
commit 3d3d024878
1 changed files with 8 additions and 2 deletions

View File

@ -81,7 +81,7 @@ function(export_all_flags _filename _source_name_for_flags)
endfunction()
function(add_precompiled_header _target _input)
if(CMAKE_COMPILER_IS_GNUCXX)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
get_filename_component(_name ${_input} NAME)
set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
@ -163,5 +163,11 @@ function(add_precompiled_header _target _input)
OBJECT_DEPENDS "${_object_depends}")
endif()
endforeach()
endif(CMAKE_COMPILER_IS_GNUCXX)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(NOT _PCH_FORCEINCLUDE)
set(_PCH_FORCEINCLUDE ON)
endif()
endif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
endif(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
endfunction()