From ea66477ac042e3df8e6922f8805db3291f485abd Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sat, 23 Dec 2023 16:28:36 +0200 Subject: [PATCH] Copy dlls to the executable folder for msvc --- bench/CMakeLists.txt | 8 ++++---- cmake/fmtlib.cmake | 2 +- example/CMakeLists.txt | 8 ++++---- tests/CMakeLists.txt | 9 ++++----- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt index ed8fcc9b..e325b6a7 100644 --- a/bench/CMakeLists.txt +++ b/bench/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright(c) 2019 spdlog authors Distributed under the MIT License (http://opensource.org/licenses/MIT) -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.14) project(spdlog_bench CXX) if(NOT TARGET spdlog) @@ -36,8 +36,8 @@ target_link_libraries(latency PRIVATE benchmark::benchmark spdlog::spdlog) add_executable(formatter-bench formatter-bench.cpp) target_link_libraries(formatter-bench PRIVATE benchmark::benchmark spdlog::spdlog) -# copy dll to the executable folder for msvc +# copy dlls to the executable folder for msvc if(MSVC AND (SPDLOG_BUILD_SHARED OR BUILD_SHARED_LIBS)) - add_custom_command(TARGET latency POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $) + add_custom_command(TARGET latency POST_BUILD COMMAND ${CMAKE_COMMAND} + -E copy_if_different $ $ $ $) endif() diff --git a/cmake/fmtlib.cmake b/cmake/fmtlib.cmake index d2b8eb1f..5879a154 100644 --- a/cmake/fmtlib.cmake +++ b/cmake/fmtlib.cmake @@ -2,7 +2,7 @@ include(FetchContent) # Always build static fmtlib version set(BUILD_SHARED_LIBS_ORIG "${BUILD_SHARED_LIBS}") -set(BUILD_SHARED_LIBS OFF CACHE BOOL "Disable BUILD_SHARED_LIBS for fmtlib" FORCE) +#set(BUILD_SHARED_LIBS OFF CACHE BOOL "Disable BUILD_SHARED_LIBS for fmtlib" FORCE) Set(FETCHCONTENT_QUIET FALSE) FetchContent_Declare( diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 88c74952..e9f42bf0 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright(c) 2019 spdlog authors Distributed under the MIT License (http://opensource.org/licenses/MIT) -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.14) project(spdlog_example CXX) if(NOT TARGET spdlog) @@ -11,8 +11,8 @@ endif() add_executable(example example.cpp) target_link_libraries(example PRIVATE spdlog::spdlog $<$:ws2_32>) -# copy dll to the executable folder for msvc +# 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 $ - $) + add_custom_command(TARGET example POST_BUILD COMMAND ${CMAKE_COMMAND} + -E copy_if_different $ $ $) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1fa89b03..aee9e39c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.14) project(spdlog_utests CXX) if(NOT TARGET spdlog) @@ -88,11 +88,10 @@ endfunction() if(SPDLOG_BUILD_TESTS OR SPDLOG_BUILD_ALL) spdlog_prepare_test(spdlog-utests spdlog::spdlog) - # copy dll to the executable folder for msvc + # copy dlls to the executable folder for msvc if(MSVC AND (SPDLOG_BUILD_SHARED OR BUILD_SHARED_LIBS)) - add_custom_command( - TARGET spdlog-utests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $) + add_custom_command(TARGET spdlog-utests POST_BUILD COMMAND ${CMAKE_COMMAND} + -E copy_if_different $ $ $ $ $) endif() endif()