Skip to content

Commit c3dd9d4

Browse files
committed
Fixed cmake error in header-only build
1 parent 37ec7cb commit c3dd9d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ if (SNITCH_DO_TEST)
214214

215215
if (NOT SNITCH_HEADER_ONLY)
216216
add_library(snitch-testlib ${SNITCH_INCLUDES} ${SNITCH_SOURCES})
217-
add_dependencies(snitch-testlib snitch)
218217

219218
target_compile_features(snitch-testlib PUBLIC cxx_std_20)
220219
target_include_directories(snitch-testlib PUBLIC
@@ -226,7 +225,6 @@ if (SNITCH_DO_TEST)
226225
configure_snitch_for_tests(snitch-testlib PUBLIC)
227226
else()
228227
add_library(snitch-testlib INTERFACE ${PROJECT_BINARY_DIR}/snitch/snitch_all.hpp)
229-
add_dependencies(snitch-testlib snitch)
230228

231229
target_compile_features(snitch-testlib INTERFACE cxx_std_20)
232230
target_include_directories(snitch-testlib INTERFACE ${PROJECT_BINARY_DIR})
@@ -235,5 +233,10 @@ if (SNITCH_DO_TEST)
235233
target_compile_definitions(snitch-testlib INTERFACE SNITCH_TEST_HEADER_ONLY)
236234
endif()
237235

236+
# This dependency is not strictly needed, but it makes developing easier:
237+
# if the "real" library fails to build, we won't try to compile the version
238+
# used in the tests.
239+
add_dependencies(snitch-testlib ${SNITCH_TARGET_NAME})
240+
238241
add_subdirectory(tests)
239242
endif()

0 commit comments

Comments
 (0)