find_package(FLEX 2.5.31 REQUIRED)
bison_target(config_parser config_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc)
+set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE)
+
flex_target(config_lexer config_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc)
+set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE)
+
add_flex_bison_dependency(config_lexer config_parser)
mkembedconfig_target(base-type.conf base-type.cpp)
icinga-perfdata.cpp test.cpp
)
+set_property(SOURCE test.cpp PROPERTY EXCLUDE_UNITY_BUILD TRUE)
+
if(ICINGA2_UNITY_BUILD)
mkunity_target(test base_test_SOURCES)
endif()
FOLDER Bin
)
+define_property(
+ SOURCE
+ PROPERTY EXCLUDE_UNITY_BUILD
+ BRIEF_DOCS "Whether to exclude the source file from unity builds"
+ FULL_DOCS "Specified whether a source file should be excluded from unity builds and should be built separately"
+)
+
function(MKUNITY_TARGET Prefix UnityInputRef)
set(UnityInput ${${UnityInputRef}})
set(UnityOutput ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}_unity.cpp)
set(RealSources "")
set(UnitySources "")
foreach(UnitySource ${UnityInput})
- if(${UnitySource} MATCHES "\\.cpp\$")
- list(APPEND UnitySources ${UnitySource})
- else()
+ get_property(SourceExcluded SOURCE ${UnitySource} PROPERTY EXCLUDE_UNITY_BUILD)
+ if(SourceExcluded MATCHES TRUE OR NOT ${UnitySource} MATCHES "\\.(cpp|cxx|cc)\$")
list(APPEND RealSources ${UnitySource})
+ else()
+ list(APPEND UnitySources ${UnitySource})
endif()
endforeach()
add_custom_command(