diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2020-05-14 14:37:06 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2020-05-14 14:40:36 +0300 |
commit | 2c3ec346ceb771191b7388fb6e5438079fedf850 (patch) | |
tree | 1722697c97e484b26f6a4d2bc40f04ba52968931 /cmake/modules | |
parent | 63c82ed8c60e0bd3694c48df2fdba4e2b3ef711e (diff) |
Exclude *.m and *.mm Objective-C sources from including pch
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/PrecompiledHeader.cmake | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cmake/modules/PrecompiledHeader.cmake b/cmake/modules/PrecompiledHeader.cmake index e5f01af21..7ef80aacf 100644 --- a/cmake/modules/PrecompiledHeader.cmake +++ b/cmake/modules/PrecompiledHeader.cmake @@ -52,6 +52,10 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + +# Use the new builtin CMake function if possible or fall back to the old one. +if (CMAKE_VERSION VERSION_LESS 3.16) + include(CMakeParseArguments) macro(combine_arguments _variable) @@ -101,9 +105,6 @@ function(export_all_flags _filename) file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}${_cxx_flags}\n") endfunction() -# Use the new builtin CMake function if possible or fall back to the old one. -if (CMAKE_VERSION VERSION_LESS 3.16) - function(add_precompiled_header _target _input) message(STATUS "Adding precompiled header ${_input} to target ${_target} with legacy method. " @@ -252,7 +253,17 @@ endfunction() else () function(add_precompiled_header _target _input) + message(STATUS "Adding precompiled header ${_input} to target ${_target}.") target_precompile_headers(${_target} PRIVATE ${_input}) + + get_target_property(_sources ${_target} SOURCES) + list(FILTER _sources INCLUDE REGEX ".*\\.mm?") + + if (_sources) + message(STATUS "PCH skipping sources: ${_sources}") + endif () + + set_source_files_properties(${_sources} PROPERTIES SKIP_PRECOMPILE_HEADERS ON) endfunction() endif (CMAKE_VERSION VERSION_LESS 3.16) |