1 # Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+
5 PROPERTY EXCLUDE_UNITY_BUILD
6 BRIEF_DOCS "Whether to exclude the source file from unity builds"
7 FULL_DOCS "Specified whether a source file should be excluded from unity builds and should be built separately"
10 if(ICINGA2_UNITY_BUILD)
15 add_executable(mkunity ${mkunity_SOURCES})
17 set_target_properties (
22 function(MKUNITY_TARGET Target Prefix UnityInputRef)
23 set(UnityInput ${${UnityInputRef}})
24 set(UnityOutput ${CMAKE_CURRENT_BINARY_DIR}/${Target}_unity.cpp)
27 foreach(UnitySource ${UnityInput})
28 get_property(SourceExcluded SOURCE ${UnitySource} PROPERTY EXCLUDE_UNITY_BUILD)
29 if(SourceExcluded MATCHES TRUE OR NOT ${UnitySource} MATCHES "\\.(cpp|cxx|cc)\$")
30 list(APPEND RealSources ${UnitySource})
32 list(APPEND UnitySources ${UnitySource})
38 ARGS ${Prefix} ${UnitySources} > ${UnityOutput}.tmp
39 COMMAND ${CMAKE_COMMAND}
40 ARGS -E copy ${UnityOutput}.tmp ${UnityOutput}
41 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
42 DEPENDS mkunity ${UnitySources}
44 list(APPEND RealSources ${UnityOutput})
45 set(${UnityInputRef} ${RealSources} PARENT_SCOPE)