-
Notifications
You must be signed in to change notification settings - Fork 16
/
airmapd.cmake
78 lines (62 loc) · 1.92 KB
/
airmapd.cmake
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
66
67
68
69
70
71
72
73
74
75
76
77
78
include(CTest)
# Cmake find modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(Boost 1.65.1 QUIET REQUIRED date_time filesystem log program_options system thread)
find_package(OpenSSL REQUIRED)
find_package(protobuf CONFIG REQUIRED)
find_library(
WE_NEED_BORINGSSLS_LIB_DECREPIT libdecrepit.a
PATHS ${AIRMAP_EXTERNAL_DEPENDENCIES_OUTPUT_PATH}
)
if (NOT WE_NEED_BORINGSSLS_LIB_DECREPIT)
message(FATAL_ERROR "Failed to find libdecrepit.a")
endif ()
if (AIRMAP_ENABLE_GRPC)
find_package(gRPC CONFIG REQUIRED)
endif ()
if (AIRMAP_ENABLE_QT)
find_package(Qt5 COMPONENTS Core REQUIRED)
endif()
# vendor-specific setup goes here
add_definitions(-DFMT_HEADER_ONLY -DBOOST_ERROR_CODE_HEADER_ONLY)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-strict-aliasing -pedantic -Wextra -Wno-implicit-fallthrough -fPIC")
include_directories(
include
src
test
vendor/
vendor/mavlink
vendor/mqtt_client_cpp/include
vendor/cpp-jwt/include/
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/src
${Boost_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS})
add_subdirectory(doc)
add_subdirectory(interfaces)
add_subdirectory(examples)
add_subdirectory(src/airmap)
add_subdirectory(test)
find_program(CLANG_FORMAT_EXECUTABLE
NAMES clang-format clang-format-5.0
clang-format-4.0 clang-format-3.9
clang-format-3.8 clang-format-3.7
clang-format-3.6 clang-format-3.5
clang-format-3.4 clang-format-3.3
DOC "clang-format executable"
)
if (CLANG_FORMAT_EXECUTABLE)
message(STATUS "Enabling format target")
file(
GLOB_RECURSE AIRMAPD_SRCS
examples/*.h examples/*.cpp
include/*.h
interfaces/*.proto
src/*.h src/*.cpp
test/*.h test/*.cpp)
add_custom_target(
format ${CLANG_FORMAT_EXECUTABLE} -style=file -i ${AIRMAPD_SRCS})
else()
message(STATUS "Enabling format target")
endif()