Skip to content

Commit 2daaf37

Browse files
committed
fix(core): link template backend in tests
1 parent c4142a9 commit 2daaf37

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎CMakeLists.txt‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ function(vix_core_try_link_template onto link_scope)
261261

262262
set(_template_candidates
263263
vix::template
264+
vix_template
264265
template
265266
)
266267

@@ -277,10 +278,11 @@ function(vix_core_try_link_template onto link_scope)
277278
target_link_libraries(${onto} ${link_scope} ${_template_found})
278279
target_compile_definitions(${onto} ${link_scope} VIX_CORE_HAS_TEMPLATE=1)
279280
set(VIX_CORE_PACKAGE_WITH_TEMPLATE ON PARENT_SCOPE)
281+
set(VIX_TEMPLATE_TARGET ${_template_found} PARENT_SCOPE)
280282
else()
281283
if (VIX_CORE_WITH_TEMPLATE STREQUAL "ON")
282284
message(FATAL_ERROR
283-
"Template required but not found (expected: vix::template or template)."
285+
"Template required but not found (expected: vix::template, vix_template or template)."
284286
)
285287
else()
286288
message(STATUS "[core] No template backend detected; building without template.")
@@ -395,6 +397,12 @@ if (CORE_SOURCES)
395397
vix_core_try_link_json(vix_core PUBLIC)
396398
vix_core_try_link_template(vix_core PUBLIC)
397399

400+
get_target_property(_vix_core_links vix_core LINK_LIBRARIES)
401+
get_target_property(_vix_core_iface_links vix_core INTERFACE_LINK_LIBRARIES)
402+
403+
message(STATUS "[core] vix_core LINK_LIBRARIES: ${_vix_core_links}")
404+
message(STATUS "[core] vix_core INTERFACE_LINK_LIBRARIES: ${_vix_core_iface_links}")
405+
398406
if (VIX_CORE_WITH_MYSQL)
399407
find_library(MYSQLCPP_CONN8_LIB mysqlcppconn8)
400408
if (MYSQLCPP_CONN8_LIB)

‎tests/CMakeLists.txt‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ function(vix_core_add_test test_name)
2525
${VIX_CORE_TEST_TARGET}
2626
)
2727

28+
if (TARGET vix::template)
29+
target_link_libraries(${test_name} PRIVATE vix::template)
30+
elseif (TARGET vix_template)
31+
target_link_libraries(${test_name} PRIVATE vix_template)
32+
elseif (TARGET template)
33+
target_link_libraries(${test_name} PRIVATE template)
34+
endif()
35+
2836
target_compile_features(${test_name} PRIVATE cxx_std_20)
2937

3038
if (BUILD_TESTING)
@@ -62,6 +70,14 @@ target_link_libraries(runtime_bench PRIVATE
6270
${VIX_CORE_TEST_TARGET}
6371
)
6472

73+
if (TARGET vix::template)
74+
target_link_libraries(runtime_bench PRIVATE vix::template)
75+
elseif (TARGET vix_template)
76+
target_link_libraries(runtime_bench PRIVATE vix_template)
77+
elseif (TARGET template)
78+
target_link_libraries(runtime_bench PRIVATE template)
79+
endif()
80+
6581
target_compile_features(runtime_bench PRIVATE cxx_std_20)
6682

6783
vix_core_add_test(format_test

0 commit comments

Comments
 (0)