Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gabime/spdlog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgabime <gmelman1@gmail.com>2019-09-08 00:42:23 +0300
committergabime <gmelman1@gmail.com>2019-09-08 00:42:23 +0300
commit45a18a61c633564311e51f5cbed2748e9cb70e2f (patch)
tree2e805fdb2ebb0ed9aaf1bc709880fdc2a3a29d5e /CMakeLists.txt
parent1857a44c7c893b4526724d5a47875d163f9d2d1c (diff)
CmakeLists.txt: Added version-number and debug suffixes + SPDLOG_BUILD_SHARED property
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 15 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efe70ef6..bfdc8df7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,11 @@ if (NOT DEFINED SPDLOG_MASTER_PROJECT)
endif()
endif ()
+# build shared option
+if(NOT WIN32)
+ option(SPDLOG_BUILD_SHARED "Build shared library" OFF)
+endif()
+
# example options
option(SPDLOG_BUILD_EXAMPLE "Build example" ${SPDLOG_MASTER_PROJECT})
option(SPDLOG_BUILD_EXAMPLE_HO "Build header only example" OFF)
@@ -81,11 +86,14 @@ set(SPDLOG_SRCS
src/file_sinks.cpp
src/async.cpp)
-if (BUILD_SHARED_LIBS AND WIN32)
- message(WARNING "shared libs is not supported in spdlog - building static instead")
- add_library(spdlog STATIC ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
+
+if (SPDLOG_BUILD_SHARED)
+ if(WIN32)
+ message(FATAL_ERROR "spdlog shared lib is not yet supported under windows")
+ endif()
+ add_library(spdlog SHARED ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
else()
- add_library(spdlog ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
+ add_library(spdlog STATIC ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
endif()
add_library(spdlog::spdlog ALIAS spdlog)
@@ -97,6 +105,9 @@ target_include_directories(spdlog PUBLIC
target_link_libraries(spdlog PUBLIC Threads::Threads)
spdlog_enable_warnings(spdlog)
+set_target_properties(spdlog PROPERTIES VERSION ${SPDLOG_VERSION} SOVERSION ${SPDLOG_VERSION_MAJOR})
+set_target_properties(spdlog PROPERTIES DEBUG_POSTFIX d)
+
#---------------------------------------------------------------------------------------
# Header only version
#---------------------------------------------------------------------------------------