From 55e7844ca079c31d798aeb77339df404fcc1626a Mon Sep 17 00:00:00 2001 From: David Zemon Date: Fri, 17 May 2019 23:15:08 -0500 Subject: Remove the namespaced Namespaces are good for avoiding collisions, but since the non-namespaced targets still exist, it does no good to add the namespaced targets on top. --- example/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'example') 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) -- cgit v1.2.3