From 67d5f655072286a25b1fccf48d46c500a1397663 Mon Sep 17 00:00:00 2001 From: gabime Date: Wed, 19 Jun 2019 17:52:50 +0300 Subject: [PATCH] CMake support for building shared lib (not for win32) --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68f478dc..a27c2019 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,9 +54,15 @@ message(STATUS "Build type: " ${CMAKE_BUILD_TYPE}) find_package(Threads REQUIRED) #--------------------------------------------------------------------------------------- -# Static library version +# Static/Shared library (shared not supported in windows yet) #--------------------------------------------------------------------------------------- -add_library(spdlog STATIC src/spdlog.cpp ${SPDLOG_ALL_HEADERS}) +if (BUILD_SHARED_LIBS AND WIN32) + message(WARNING "shared libs is not supported in spdlog - building static instead") + add_library(spdlog STATIC src/spdlog.cpp ${SPDLOG_ALL_HEADERS}) +else() + add_library(spdlog src/spdlog.cpp ${SPDLOG_ALL_HEADERS}) +endif() + add_library(spdlog::spdlog ALIAS spdlog) target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB)