Skip to content

Commit

Permalink
cmake: Fix conditional linking of fmt
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
taminob committed Nov 26, 2024
1 parent 0150683 commit 812be55
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<BOOL:${PPPLUGIN_ENABLE_CPP17_COMPATIBILITY}>:fmt::fmt>)
target_include_directories(
${LIBRARY_TARGET}
PRIVATE ${LUA_INCLUDE_DIR}
Expand Down

0 comments on commit 812be55

Please sign in to comment.