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-04-27 18:44:48 +0300
committergabime <gmelman1@gmail.com>2019-04-27 18:44:48 +0300
commit69fcaf14e5337911149c638d41bd30b97b735946 (patch)
tree9188c201afcc37f1a8c170d6f728afa7365201a5 /CMakeLists.txt
parentf414198feeb6057d117c15a967a2ca13958afbce (diff)
wip static-lib
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt43
1 files changed, 14 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1dadcb43..19d777a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,5 @@
-
-#
-# Copyright(c) 2015 Ruslan Baratov.
+# Copyright(c) 2019 spdlog
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
-#
cmake_minimum_required(VERSION 3.1)
project(spdlog VERSION 1.3.1 LANGUAGES CXX)
@@ -47,48 +44,36 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(SPDLOG_MASTER_PROJECT ON)
endif()
-option(SPDLOG_HEADER_ONLY "Header only version. Turn OFF to build as static lib" OFF)
+option(SPDLOG_STATIC_LIB "Build as static lib" OFF)
option(SPDLOG_BUILD_EXAMPLES "Build examples" ${SPDLOG_MASTER_PROJECT})
option(SPDLOG_BUILD_BENCH "Build benchmarks (Requires https://github.com/google/benchmark.git to be installed)" ON)
option(SPDLOG_BUILD_TESTS "Build tests" ${SPDLOG_MASTER_PROJECT})
option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF)
option(SPDLOG_INSTALL "Generate the install target." ${SPDLOG_MASTER_PROJECT})
-set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include")
-
-if(SPDLOG_HEADER_ONLY)
- add_definitions(-DSPDLOG_HEADER_ONLY)
- add_library(spdlog INTERFACE)
- add_library(spdlog::spdlog ALIAS spdlog)
- target_include_directories(
- spdlog
- INTERFACE
- "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
- )
+set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include/spdlog")
-else()
- remove_definitions(-DSPDLOG_HEADER_ONLY)
- file(GLOB SRC_FILES ${HEADER_BASE}/spdlog/impl/*.cpp)
+if(SPDLOG_STATIC_LIB)
+ add_definitions(-DSPDLOG_STATIC_LIB)
+ file(GLOB SRC_FILES ${HEADER_BASE}/impl/*.cpp)
add_library(spdlog STATIC ${SRC_FILES})
- add_library(spdlog::spdlog ALIAS spdlog)
- target_include_directories(
- spdlog
- PUBLIC
- "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
- )
+ target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
+else()
+ add_library(spdlog INTERFACE)
+ target_include_directories(spdlog INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
endif()
+add_library(spdlog::spdlog ALIAS spdlog)
+
if(SPDLOG_FMT_EXTERNAL AND NOT TARGET fmt::fmt)
find_package(fmt REQUIRED CONFIG)
endif()
-
if(SPDLOG_FMT_EXTERNAL)
target_compile_definitions(spdlog INTERFACE SPDLOG_FMT_EXTERNAL)
target_link_libraries(spdlog INTERFACE fmt::fmt)
endif()
-
if(SPDLOG_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
@@ -105,9 +90,9 @@ endif()
#---------------------------------------------------------------------------------------
# install
#---------------------------------------------------------------------------------------
-install(DIRECTORY ${HEADER_BASE}/spdlog DESTINATION include)
+install(DIRECTORY ${HEADER_BASE} DESTINATION include)
-if(NOT SPDLOG_HEADER_ONLY)
+if(SPDLOG_STATIC_LIB)
install(TARGETS spdlog ARCHIVE DESTINATION lib)
endif()