From 15f52c5229c506385773b94d264c4035d229a026 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Sat, 13 Jun 2026 20:05:37 +0200 Subject: [PATCH] Ensure fmt dependency does not leak to downstream users Fixes #1354 --- CMakeLists.txt | 6 ------ cmake/soci_define_backend_target.cmake | 2 +- src/core/CMakeLists.txt | 2 +- tests/common/CMakeLists.txt | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56ebbe78..fbbf2953 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,9 +139,6 @@ elseif(NOT SOCI_FMT_BUILTIN) endif() endif() -# Name of the library to link with. -set(soci_fmt fmt::fmt) - if(soci_use_bundled_fmt) if (NOT EXISTS ${PROJECT_SOURCE_DIR}/3rdparty/fmt/CMakeLists.txt) message( @@ -152,9 +149,6 @@ if(soci_use_bundled_fmt) endif() add_subdirectory(3rdparty/fmt EXCLUDE_FROM_ALL) - - # Use the header-only version to avoid forcing SOCI users to link with it. - set(soci_fmt $) endif() # Helper function appending prefix and suffix to the library name. diff --git a/cmake/soci_define_backend_target.cmake b/cmake/soci_define_backend_target.cmake index 957cef2d..b87c2072 100644 --- a/cmake/soci_define_backend_target.cmake +++ b/cmake/soci_define_backend_target.cmake @@ -149,7 +149,7 @@ function(soci_define_backend_target) endforeach() # Set settings common to all backends. - target_link_libraries(${DEFINE_BACKEND_TARGET_NAME} PUBLIC SOCI::Core PRIVATE ${soci_fmt}) + target_link_libraries(${DEFINE_BACKEND_TARGET_NAME} PUBLIC SOCI::Core PRIVATE $) target_include_directories(${DEFINE_BACKEND_TARGET_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/include/private") soci_build_library_name(full_backend_target_name "${DEFINE_BACKEND_TARGET_NAME}") diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b3fb7508..6bc90790 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -125,7 +125,7 @@ if (SOCI_SHARED) target_compile_definitions(soci_core PUBLIC SOCI_DLL) endif() -target_link_libraries(soci_core PRIVATE ${soci_fmt}) +target_link_libraries(soci_core PRIVATE $) if (WITH_BOOST) # Try and find Boost with the date_time component. diff --git a/tests/common/CMakeLists.txt b/tests/common/CMakeLists.txt index add347a2..2e1b218b 100644 --- a/tests/common/CMakeLists.txt +++ b/tests/common/CMakeLists.txt @@ -33,7 +33,7 @@ target_link_libraries(soci_tests_common PUBLIC soci_compiler_interface SOCI::Core - ${soci_fmt} + $ ) target_include_directories(soci_tests_common