-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·48 lines (35 loc) · 1.52 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
cmake_minimum_required(VERSION 2.8)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(aiserver LANGUAGES CXX C)
set(DESCRIPTION "aiserver projects for smart screen")
set(PROJECT_THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty")
include(clang-format)
include(cppcheck)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
message(FATAL_ERROR "this project can only be built for linux")
endif()
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
endif()
add_definitions(-DDBUS_HAS_RECURSIVE_MUTEX)
add_definitions(-fPIC)
option(SANITIZER_STATIC "compile with sanitizer (static library linker)" OFF)
if(SANITIZER_STATIC)
add_definitions(-fsanitize=address -static-libasan -g -ggdb -gdwarf -funwind-tables -rdynamic -O0)
add_definitions(-fno-stack-protector -fno-omit-frame-pointer -fsanitize-recover=address)
# add_definitions(-fsanitize=undefined)
link_libraries(libasan.a dl m rt)
endif()
option(SANITIZER_DYNAMIC "compile with sanitizer (dynamic library linker)" OFF)
if(SANITIZER_DYNAMIC)
# NOTE: copy libasan.so with manual operation
add_definitions(-fsanitize=address -g -ggdb -gdwarf -funwind-tables -rdynamic -O0)
add_definitions(-fno-stack-protector -fno-omit-frame-pointer -fsanitize-recover=address)
# add_definitions(-fsanitize=undefined)
link_libraries(asan)
endif()
add_compile_options(-std=c++11 -Wno-psabi)
find_package(Threads REQUIRED)
find_package(Dbus REQUIRED)
find_package(DbusC++ REQUIRED)
add_subdirectory(src)