From ae9dd9d0e3797643fad9990347307c2521574c2d Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Tue, 26 Nov 2024 23:26:33 +0100 Subject: [PATCH] cmake: Fix conditional linking of fmt If a simple "if" is used instead, the generated cmake target files will include the fmt dependency no matter what the surrounding "if" is evaluated to. With the generator expression, cmake can detect on generation of the files if the dependency should be included or not. --- src/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9a02424..1be4a5f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,10 +17,8 @@ target_link_libraries( ${LIBRARY_TARGET} PUBLIC Boost::filesystem PUBLIC Python::Python - PRIVATE ${LUA_LIBRARIES}) -if(${PPPLUGIN_ENABLE_CPP17_COMPATIBILITY}) - target_link_libraries(${LIBRARY_TARGET} PUBLIC fmt::fmt) -endif() + PRIVATE ${LUA_LIBRARIES} + PUBLIC $<$:fmt::fmt>) target_include_directories( ${LIBRARY_TARGET} PRIVATE ${LUA_INCLUDE_DIR}