From 65c7e85f186d41991d10f072eaebb3cb3b235bec Mon Sep 17 00:00:00 2001 From: Sascha Kratky Date: Sun, 5 Jul 2015 11:33:27 +0200 Subject: [PATCH] apply user provided prefix header to unity build target --- CMake/cotire.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CMake/cotire.cmake b/CMake/cotire.cmake index 6c99228..22e29f9 100644 --- a/CMake/cotire.cmake +++ b/CMake/cotire.cmake @@ -2731,6 +2731,20 @@ function (cotire_collect_unity_target_sources _target _languages _unityTargetSou set (${_unityTargetSourcesVar} ${_unityTargetSources} PARENT_SCOPE) endfunction() +function (cotire_setup_unity_target_pch_usage _languages _target) + foreach (_language ${_languages}) + get_property(_unityFiles TARGET ${_target} PROPERTY COTIRE_${_language}_UNITY_SOURCE) + if (_unityFiles) + get_property(_userPrefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT) + get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) + if (_userPrefixFile AND _prefixFile) + # user provided prefix header must be included unconditionally by unity sources + cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" ${_unityFiles}) + endif() + endif() + endforeach() +endfunction() + function (cotire_setup_unity_build_target _languages _configurations _target) get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME) if (NOT _unityTargetName) @@ -2956,6 +2970,9 @@ function (cotire_target _target) if (_targetUsePCH) cotire_setup_target_pch_usage("${_targetLanguages}" ${_target} ${_wholeTarget} ${_cmds}) cotire_setup_pch_target("${_targetLanguages}" "${_option_CONFIGURATIONS}" ${_target}) + if (_targetAddSCU) + cotire_setup_unity_target_pch_usage("${_targetLanguages}" ${_target}) + endif() endif() get_target_property(_targetAddCleanTarget ${_target} COTIRE_ADD_CLEAN) if (_targetAddCleanTarget)