diff --git a/CMakeLists.txt b/CMakeLists.txt index c728d940f..1df4a49c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -910,8 +910,9 @@ endif() # Link SOD library if enabled if(ENABLE_SOD) - # Always link to the sod target, whether it's built as static or shared - target_link_libraries(lightnvr sod) + # SOD symbols are used by objects in this static library. Publish the + # dependency so the main executable, tests and utilities all inherit it. + target_link_libraries(lightnvr_lib PUBLIC sod) # Log the linking method for clarity if(SOD_DYNAMIC_LINK) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 912f85c26..e59fd4e72 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -44,9 +44,6 @@ macro(add_layer2_test TEST_NAME) if(ENABLE_MQTT AND MOSQUITTO_FOUND) target_link_libraries(${TEST_NAME} ${MOSQUITTO_LIBRARIES}) endif() - if(ENABLE_SOD) - target_link_libraries(${TEST_NAME} sod) - endif() set_target_properties(${TEST_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") if("${TEST_NAME}" STREQUAL "test_storage_archive") find_package(Python3 COMPONENTS Interpreter REQUIRED) @@ -112,9 +109,6 @@ macro(add_layer3_test TEST_NAME) if(ENABLE_MQTT AND MOSQUITTO_FOUND) target_link_libraries(${TEST_NAME} ${MOSQUITTO_LIBRARIES}) endif() - if(ENABLE_SOD) - target_link_libraries(${TEST_NAME} sod) - endif() set_target_properties(${TEST_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) lightnvr_ci_test(${TEST_NAME} ${ARGN})