Skip to content

Commit 53e1449

Browse files
committed
Fixed CMake install when compiled with extensions
This is a fix from the change I made in `commit 418c163` where I added options to compile unity with the `fixture` and `memory` extensions: In that version, Unity had been able to build, but there were some issues when trying to install it. Namely, the CMake generator expressions were not evaluated correctly, and it would try to install with a path that had un-expanded generator commands in it, which would obviously fail and throw an error. I've got a feeling that this is a bug with CMake, but for now the workaround that worked in [this stackoverflow post](https://stackoverflow.com/questions/51541678/nested-cmake-generator-expressions-are-only-partially-evaluated) seemed to work here, as well. Another issue with that commit was that it tried to include a `unity_memory_internals.h` file, which did not exist. This has also been resolved.
1 parent 418c163 commit 53e1449

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ project(unity
4545
option(UNITY_EXTENSION_FIXTURE "Compiles Unity with the \"fixture\" extension." OFF)
4646
option(UNITY_EXTENSION_MEMORY "Compiles Unity with the \"memory\" extension." OFF)
4747

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}>>)
48+
set(UNITY_EXTENSION_FIXTURE_ENABLED $<BOOL:${UNITY_EXTENSION_FIXTURE}>)
49+
set(UNITY_EXTENSION_MEMORY_ENABLED $<OR:${UNITY_EXTENSION_FIXTURE_ENABLED},$<BOOL:${UNITY_EXTENSION_MEMORY}>>)
5150

5251
if(${UNITY_EXTENSION_FIXTURE})
5352
message(STATUS "Unity: Bulding with the fixture extension.")
@@ -84,10 +83,9 @@ target_include_directories(${PROJECT_NAME}
8483
set(${PROJECT_NAME}_PUBLIC_HEADERS
8584
src/unity.h
8685
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>
86+
$<$<BOOL:${UNITY_EXTENSION_FIXTURE_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/fixture/src/unity_fixture.h>
87+
$<$<BOOL:${UNITY_EXTENSION_FIXTURE_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/fixture/src/unity_fixture_internals.h>
88+
$<$<BOOL:${UNITY_EXTENSION_MEMORY_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/memory/src/unity_memory.h>
9189
)
9290

9391
set_target_properties(${PROJECT_NAME}

0 commit comments

Comments
 (0)