-
-
Notifications
You must be signed in to change notification settings - Fork 510
/
CMakeLists.txt
122 lines (109 loc) · 2.91 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
include_directories(
SYSTEM ${PROJECT_SOURCE_DIR}/third_party/mavlink/include
)
configure_file(version.h.in version.h)
add_library(mavsdk
call_every_handler.cpp
connection.cpp
connection_result.cpp
curl_wrapper.cpp
system.cpp
system_impl.cpp
mavsdk.cpp
mavsdk_impl.cpp
global_include.cpp
http_loader.cpp
mavlink_channels.cpp
mavlink_commands.cpp
mavlink_mission_transfer.cpp
mavlink_parameters.cpp
mavlink_receiver.cpp
mavlink_statustext_handler.cpp
mavlink_message_handler.cpp
ping.cpp
plugin_impl_base.cpp
serial_connection.cpp
tcp_connection.cpp
timeout_handler.cpp
udp_connection.cpp
log.cpp
cli_arg.cpp
geometry.cpp
timesync.cpp
)
target_link_libraries(mavsdk
PRIVATE
CURL::libcurl
Threads::Threads
)
set_target_properties(mavsdk PROPERTIES
VERSION ${MAVSDK_VERSION_STRING}
SOVERSION ${MAVSDK_SOVERSION_STRING}
)
if (IOS)
target_link_libraries(mavsdk
PUBLIC
"-framework Foundation"
"-framework Security"
)
endif()
# Link to Windows networking lib.
if (MSVC OR MINGW)
target_link_libraries(mavsdk
PRIVATE
ws2_32
)
endif()
if(ANDROID)
target_link_libraries(mavsdk
PRIVATE
log
)
endif()
if(BUILD_STATIC_MAVSDK_SERVER AND ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
target_link_libraries(mavsdk PRIVATE atomic)
endif()
set_target_properties(mavsdk
PROPERTIES COMPILE_FLAGS ${warnings}
)
target_include_directories(mavsdk
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
install(TARGETS mavsdk
EXPORT mavsdk-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(FILES
connection_result.h
deprecated.h
system.h
mavsdk.h
plugin_base.h
geometry.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/mavsdk"
)
list(APPEND UNIT_TEST_SOURCES
${PROJECT_SOURCE_DIR}/core/global_include_test.cpp
${PROJECT_SOURCE_DIR}/core/mavlink_channels_test.cpp
${PROJECT_SOURCE_DIR}/core/unittests_main.cpp
# TODO: add this again
#${PROJECT_SOURCE_DIR}/core/http_loader_test.cpp
${PROJECT_SOURCE_DIR}/core/timeout_handler_test.cpp
${PROJECT_SOURCE_DIR}/core/call_every_handler_test.cpp
${PROJECT_SOURCE_DIR}/core/curl_test.cpp
${PROJECT_SOURCE_DIR}/core/cli_arg_test.cpp
${PROJECT_SOURCE_DIR}/core/locked_queue_test.cpp
${PROJECT_SOURCE_DIR}/core/safe_queue_test.cpp
${PROJECT_SOURCE_DIR}/core/mavsdk_test.cpp
${PROJECT_SOURCE_DIR}/core/mavlink_mission_transfer_test.cpp
${PROJECT_SOURCE_DIR}/core/mavlink_statustext_handler_test.cpp
${PROJECT_SOURCE_DIR}/core/geometry_test.cpp
)
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES} PARENT_SCOPE)