spdlog/example/CMakeLists.txt

22 lines
645 B
CMake
Raw Normal View History

2020-05-02 16:38:14 +08:00
# Copyright(c) 2019 spdlog authors Distributed under the MIT License (http://opensource.org/licenses/MIT)
cmake_minimum_required(VERSION 3.11)
project(spdlog_example CXX)
2019-05-29 05:04:36 +08:00
if(NOT TARGET spdlog)
2020-05-02 16:42:08 +08:00
# Stand-alone build
find_package(spdlog REQUIRED)
endif()
add_executable(example example.cpp)
target_link_libraries(example PRIVATE spdlog::spdlog $<$<BOOL:${MINGW}>:ws2_32>)
# copy dll 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_DIR:example>)
endif()