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:
authorDavid Zemon <david@zemon.name>2019-05-18 07:20:30 +0300
committerDavid Zemon <david@zemon.name>2019-05-18 07:27:44 +0300
commit107fe0a14231587a03921a22300fb988e0a9ebe0 (patch)
tree8f27999fb0723dce37df8785319aa993450052fc /example
parentb021be29e56a6b539c067a247904d54d051ca492 (diff)
Ensure header_only library works by adding another example exe
Diffstat (limited to 'example')
-rw-r--r--example/CMakeLists.txt15
1 files changed, 12 insertions, 3 deletions
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 9dc977e7..b25ca252 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -36,14 +36,22 @@ endif()
find_package(Threads REQUIRED)
+# Example of using pre-compiled library
add_executable(example example.cpp)
+target_link_libraries(example spdlog::spdlog Threads::Threads)
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
find_library(log-lib log)
- target_link_libraries(example spdlog::spdlog Threads::Threads log)
-else()
- target_link_libraries(example spdlog::spdlog Threads::Threads)
+ 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)
+endif ()
add_executable(multisink multisink.cpp)
target_link_libraries(multisink spdlog::spdlog Threads::Threads)
@@ -52,3 +60,4 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
enable_testing()
add_test(NAME example COMMAND example)
+add_test(NAME example_header_only COMMAND example)