-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
38 lines (30 loc) · 966 Bytes
/
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
cmake_minimum_required(VERSION 3.2)
project(utils)
set(utils_VERSION 1.1)
# options
option(ENABLE_TEST "Enable testing" ON)
option(ENABLE_LOGGING "Enable logging" ON)
# check for optional required features
include(CheckIncludeFiles)
check_include_files(syslog.h HAVE_SYSLOG_H)
configure_file("include/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/libutils/config.h")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/libutils/config.h"
DESTINATION include/libutils
COMPONENT headers)
# first update the flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall")
if (ENABLE_LOGGING)
set(CMAKE_C_FLAGS_RELEASE "-DENABLE_LOGGING -DLOG_NODEBUG")
endif ()
set(CMAKE_C_FLAGS_DEBUG "-DENABLE_LOGGING -DDEBUG")
# main include directory
include_directories("include")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/include")
if (ENABLE_TEST)
enable_testing()
add_subdirectory("tests")
endif ()
add_subdirectory("src")
add_subdirectory("include")