]> granicus.if.org Git - icinga2/blob - tools/mkunity/CMakeLists.txt
Replace std::shared_ptr<boost::asio::ip::tcp::acceptor> with Shared<boost::asio:...
[icinga2] / tools / mkunity / CMakeLists.txt
1 # Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+
2
3 define_property(
4   SOURCE
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"
8 )
9
10 if(ICINGA2_UNITY_BUILD)
11   set(mkunity_SOURCES
12     mkunity.c
13   )
14
15   add_executable(mkunity ${mkunity_SOURCES})
16
17   set_target_properties (
18     mkunity PROPERTIES
19     FOLDER Bin
20   )
21
22   function(MKUNITY_TARGET Target Prefix UnityInputRef)
23     set(UnityInput ${${UnityInputRef}})
24     set(UnityOutput ${CMAKE_CURRENT_BINARY_DIR}/${Target}_unity.cpp)
25     set(RealSources "")
26     set(UnitySources "")
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})
31       else()
32           list(APPEND UnitySources ${UnitySource})
33       endif()
34     endforeach()
35     add_custom_command(
36       OUTPUT ${UnityOutput}
37       COMMAND mkunity
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}
43     )
44     list(APPEND RealSources ${UnityOutput})
45     set(${UnityInputRef} ${RealSources} PARENT_SCOPE)
46   endfunction()
47 endif()