CMakeLists.txt 1.02 KB
Newer Older
Gabi Melman's avatar
Gabi Melman committed
1 2
# Copyright(c) 2019 spdlog authors
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
3

4
cmake_minimum_required(VERSION 3.1)
gabime's avatar
gabime committed
5
project(spdlog_examples CXX)
6

gabime's avatar
gabime committed
7
if(NOT TARGET spdlog)
David Zemon's avatar
David Zemon committed
8 9
    # Stand-alone build
    find_package(spdlog REQUIRED)
10 11
endif()

gabime's avatar
gabime committed
12
#---------------------------------------------------------------------------------------
13
# Example of using pre-compiled library
gabime's avatar
gabime committed
14
#---------------------------------------------------------------------------------------
15
add_executable(example example.cpp)
16
spdlog_enable_warnings(example)
gabime's avatar
gabime committed
17
target_link_libraries(example PRIVATE spdlog::spdlog)
18

gabime's avatar
gabime committed
19
#---------------------------------------------------------------------------------------
20
# Example of using header-only library
gabime's avatar
gabime committed
21
#---------------------------------------------------------------------------------------
22 23 24 25 26
if(SPDLOG_BUILD_EXAMPLE_HO)
    add_executable(example_header_only example.cpp)
    spdlog_enable_warnings(example_header_only)
    target_link_libraries(example_header_only PRIVATE spdlog::spdlog_header_only)
endif()
gabime's avatar
gabime committed
27