@@ -41,6 +41,22 @@ project(unity
4141 DESCRIPTION "C Unit testing framework."
4242)
4343
44+ # Options to Build With Extras -------------------------------------------------
45+ option (UNITY_EXTENSION_FIXTURE "Compiles Unity with the \" fixture\" extension." OFF )
46+ option (UNITY_EXTENSION_MEMORY "Compiles Unity with the \" memory\" extension." OFF )
47+
48+ # Fixture is a dependant of memory
49+ set (UNITY_EXTENSION_FIXTURE_ENABLED ${UNITY_EXTENSION_FIXTURE} )
50+ set (UNITY_EXTENSION_MEMORY_ENABLED $<OR :$<BOOL :${UNITY_EXTENSION_MEMORY} >,$<BOOL :${UNITY_EXTENSION_FIXTURE} >>)
51+
52+ if (${UNITY_EXTENSION_FIXTURE} )
53+ message (STATUS "Unity: Bulding with the fixture extension." )
54+ endif ()
55+
56+ if (${UNITY_EXTENSION_MEMORY} )
57+ message (STATUS "Unity: Bulding with the memory extension." )
58+ endif ()
59+
4460# Main target ------------------------------------------------------------------
4561add_library (${PROJECT_NAME} STATIC )
4662add_library (${PROJECT_NAME} ::framework ALIAS ${PROJECT_NAME} )
@@ -52,17 +68,26 @@ include(CMakePackageConfigHelpers)
5268target_sources (${PROJECT_NAME}
5369 PRIVATE
5470 src/unity.c
71+ $<$<BOOL :${UNITY_EXTENSION_FIXTURE_ENABLED} >:extras /fixture /src /unity_fixture .c >
72+ $<$<BOOL :${UNITY_EXTENSION_MEMORY_ENABLED} >:extras /memory /src /unity_memory .c >
5573)
5674
5775target_include_directories (${PROJECT_NAME}
5876 PUBLIC
5977 $<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR} /src >
6078 $<BUILD_INTERFACE :${CMAKE_CURRENT_BINARY_DIR} >
6179 $<INSTALL_INTERFACE :${CMAKE_INSTALL_INCLUDEDIR} /${PROJECT_NAME} >
80+ $<BUILD_INTERFACE :$<$<BOOL :${UNITY_EXTENSION_MEMORY_ENABLED} >:${CMAKE_CURRENT_SOURCE_DIR} /extras /memory /src >>
81+ $<BUILD_INTERFACE :$<$<BOOL :${UNITY_EXTENSION_FIXTURE_ENABLED} >:${CMAKE_CURRENT_SOURCE_DIR} /extras /fixture /src >>
6282)
6383
64- set (${PROJECT_NAME} _PUBLIC_HEADERS src/unity.h
65- src/unity_internals.h
84+ set (${PROJECT_NAME} _PUBLIC_HEADERS
85+ src/unity.h
86+ src/unity_internals.h
87+ $<$<BOOL :${UNITY_EXTENSION_FIXTURE_ENABLED} >:extras /fixture /src /unity_fixture .h
88+ extras /fixture /src /unity_fixture_internals .h >
89+ $<$<BOOL :${UNITY_EXTENSION_MEMORY_ENABLED} >:extras /memory /src /unity_memory .h
90+ extras /memory /src /unity_memory_internals .h >
6691)
6792
6893set_target_properties (${PROJECT_NAME}
0 commit comments