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-05-19 16:34:38 +0300
committergabime <gmelman1@gmail.com>2019-05-19 16:34:38 +0300
commit2cd53c6ff1e057349e8a2c6db2f05ab27f767fdd (patch)
tree13c18044e50249ca9e7b980f8fc92305eba6f1b2 /example
parent18ccd55725b1bc27aaee90db9d442eb614f8a4e3 (diff)
Updated cmake example
Diffstat (limited to 'example')
-rw-r--r--example/CMakeLists.txt19
1 files changed, 7 insertions, 12 deletions
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index bd722d45..8efc1eb1 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -29,28 +29,23 @@ if(TARGET spdlog)
# 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)
- find_package(Threads REQUIRED)
+ add_library(spdlog::spdlog_header_only ALIAS spdlog_header_only)
else()
# Stand-alone build
find_package(spdlog REQUIRED)
endif()
-
+#---------------------------------------------------------------------------------------
# Example of using pre-compiled library
+#---------------------------------------------------------------------------------------
add_executable(example example.cpp)
target_link_libraries(example spdlog::spdlog)
-if(CMAKE_SYSTEM_NAME STREQUAL "Android")
- find_library(log-lib log)
- target_link_libraries(example log)
-endif()
+#---------------------------------------------------------------------------------------
# Example of using header-only library
+#---------------------------------------------------------------------------------------
add_executable(example_header_only example.cpp)
-get_target_property(SPDLOG_INCLUDE_DIRS spdlog::spdlog INTERFACE_INCLUDE_DIRECTORIES)
-target_include_directories(example_header_only PRIVATE ${SPDLOG_INCLUDE_DIRS})
-target_link_libraries(example_header_only Threads::Threads)
-if(CMAKE_SYSTEM_NAME STREQUAL "Android")
- target_link_libraries(example_header_only log Threads::Threads)
-endif ()
+target_link_libraries(example_header_only spdlog::spdlog_header_only)
+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")