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:
-rw-r--r--CMakeLists.txt2
-rw-r--r--example/CMakeLists.txt11
-rw-r--r--tests/CMakeLists.txt2
3 files changed, 9 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 042ac7a7..c939248b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,7 +58,6 @@ message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# Build library
add_library(spdlog src/spdlog.cpp)
-add_library(spdlog::spdlog ALIAS spdlog)
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB )
target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
set_target_properties(spdlog PROPERTIES OUTPUT_NAME "spdlog")
@@ -67,7 +66,6 @@ set_target_properties(spdlog PROPERTIES DEBUG_POSTFIX "-debug")
# Headr only
add_library(spdlog_header_only INTERFACE)
target_include_directories(spdlog_header_only INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
-add_library(spdlog::header_only ALIAS spdlog_header_only)
if(SPDLOG_FMT_EXTERNAL AND NOT TARGET fmt::fmt)
find_package(fmt REQUIRED CONFIG)
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 98bdca6e..9dc977e7 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -24,9 +24,14 @@
cmake_minimum_required(VERSION 3.1)
project(SpdlogExamples CXX)
-if(NOT TARGET spdlog::spdlog)
- # Stand-alone build
- find_package(spdlog CONFIG REQUIRED)
+if(TARGET spdlog)
+ # If we're running this example as part of the primary spdlog applciation
+ # then add an alias. This allows us to use the same "spdlog::spdlog"
+ # below that a user would use (with the namespace)
+ add_library(spdlog::spdlog ALIAS spdlog)
+else()
+ # Stand-alone build
+ find_package(spdlog REQUIRED)
endif()
find_package(Threads REQUIRED)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 48f80e0e..8679174d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -21,7 +21,7 @@ set(SPDLOG_UTESTS_SOURCES
add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
-target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog)
+target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")