place dlls in the same directory as the executables on msvc

This commit is contained in:
Gabi Melman
2023-12-24 12:28:02 +02:00
parent 8a0f87406b
commit 90c5055b77
5 changed files with 20 additions and 23 deletions

View File

@@ -9,10 +9,4 @@ if(NOT TARGET spdlog)
endif()
add_executable(example example.cpp)
target_link_libraries(example PRIVATE spdlog::spdlog $<$<BOOL:${MINGW}>:ws2_32>)
# copy dlls to the executable folder for msvc
if(MSVC AND (SPDLOG_BUILD_SHARED OR BUILD_SHARED_LIBS))
add_custom_command(TARGET example POST_BUILD COMMAND ${CMAKE_COMMAND}
-E copy_if_different $<TARGET_FILE:spdlog> $<TARGET_FILE:fmt> $<TARGET_FILE_DIR:example>)
endif()
target_link_libraries(example PRIVATE spdlog::spdlog $<$<BOOL:${MINGW}>:ws2_32>)