-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
50 lines (38 loc) · 1.08 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.5...3.31)
# Set cmake_policies
include(cmake/policy.cmake)
use_cmake_policy()
project(ulog)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(ULOG_BUILD_EXAMPLES "Build examples" OFF)
option(ULOG_BUILD_TESTS "Build tests" OFF)
option(ULOG_BUILD_TOOLS "Build tools" ON)
# Generate git version info
include(cmake/git_version.cmake)
set_git_version(ULOG_GIT_TAG)
message(STATUS "ulog version: ${ULOG_GIT_TAG}")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_compile_options(-Wextra -Wall)
# ulog library
add_library(ulog src/ulog.c)
target_include_directories(ulog PUBLIC include)
if (ULOG_BUILD_EXAMPLES OR ULOG_BUILD_TOOLS)
include(cmake/zstd.cmake)
endif ()
if (ULOG_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
if (ULOG_BUILD_TESTS)
include(cmake/googletest.cmake)
enable_testing()
add_subdirectory(tests)
endif ()
if (ULOG_BUILD_TOOLS)
add_subdirectory(tools)
endif ()
# install
install(TARGETS ulog
ARCHIVE DESTINATION lib)
install(DIRECTORY include/ulog DESTINATION include)