From 497fe847e721f92691daf1de3d454d29871e27a4 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sat, 7 Nov 2026 17:19:46 -0500 Subject: [PATCH 1/2] Apply suggested fix to CMakeLists.txt from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c728d940f..dbb368832 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -910,7 +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 + # Link sod to the shared project library so all its consumers inherit it. + target_link_libraries(lightnvr_lib PUBLIC sod) + # Keep direct linkage for the main executable. target_link_libraries(lightnvr sod) # Log the linking method for clarity From e54734a9739e701f5049dbcd8d9c7e825839524f Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sat, 7 Nov 2026 17:47:34 -0500 Subject: [PATCH 2/2] Use transitive SOD linkage for executables and unit tests --- CMakeLists.txt | 5 ++--- tests/unit/CMakeLists.txt | 6 ------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbb368832..1df4a49c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -910,10 +910,9 @@ endif() # Link SOD library if enabled if(ENABLE_SOD) - # Link sod to the shared project library so all its consumers inherit it. + # 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) - # Keep direct linkage for the main executable. - target_link_libraries(lightnvr 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})