This repository was archived by the owner on Apr 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
65 lines (52 loc) · 1.27 KB
/
CMakeLists.txt
File metadata and controls
65 lines (52 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
cmake_minimum_required(VERSION 3.0)
project(cpplog
VERSION 0.0.0
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
option(CPPLOG_BUILD_TESTS "Build unit tests" ON)
option(CPPLOG_BUILD_EXAMPLES "Build examples" ON)
if(CMAKE_PROJECT_NAME STREQUAL cpplog)
set(CPPLOG_IS_TOP_PROEJCT True)
else()
set(CPPLOG_IS_TOP_PROEJCT False)
endif()
if(NOT CPPLOG_IS_TOP_PROEJCT)
if(NOT TARGET fmt)
message(FATAL_ERROR "fmt library is required")
endif()
if(NOT TARGET nlohmann_json)
message(FATAL_ERROR "nlohmann_json library is required")
endif()
else()
# use submodule fmt
add_subdirectory(third_party/fmt)
# use submodule nlohmann_json
set(BuildTests OFF)
add_subdirectory(third_party/json)
unset(BuildTests)
endif()
### cpplog library
add_library(cpplog INTERFACE)
target_include_directories(cpplog INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(cpplog
INTERFACE
fmt
nlohmann_json
# link to pthread is required to use std::call_once
pthread
)
add_subdirectory(cpplog)
### Examples
if (CPPLOG_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
link_libraries(cpplog)
### Tests
if (CPPLOG_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif(CPPLOG_BUILD_TESTS)
# Tools
add_subdirectory(tools)