forked from fairlight1337/libcflie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (51 loc) · 1.83 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
cmake_minimum_required(VERSION 2.6)
project(cflie)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(${PROJECT_NAME}_VERSION_MAJOR_0)
set(${PROJECT_NAME}_VERSION_MINOR_1)
include_directories("${PROJECT_SOURCE_DIR}/include")
find_library(GLFW_LIB glfw)
if(${GLFW_LIB} STREQUAL "GLFW_LIB-NOTFOUND")
message(STATUS "The GLFW libs appear to not be installed.")
message(FATAL_ERROR "On Ubuntu, do: sudo apt-get install libglfw-dev libglfw2")
endif()
find_library(USB_LIB usb-1.0)
if(${USB_LIB} STREQUAL "USB_LIB-NOTFOUND")
message(STATUS "The USB libs appear to not be installed.")
message(FATAL_ERROR "On Ubuntu, do: sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev")
endif()
### Libraries ###
add_library(${PROJECT_NAME}
src/cflie/CCrazyRadio.cpp
src/cflie/CCrazyflie.cpp
src/cflie/CCRTPPacket.cpp
src/cflie/CTOC.cpp)
### Executables ###
add_executable(ex-replugging src/examples/replugging.cpp)
add_executable(ex-simple src/examples/simple.cpp)
add_executable(ex-gui src/examples/gui.cpp)
### Linking ###
target_link_libraries(${PROJECT_NAME} ${USB_LIB})
target_link_libraries(ex-replugging ${PROJECT_NAME})
target_link_libraries(ex-simple ${PROJECT_NAME})
target_link_libraries(ex-gui ${PROJECT_NAME} ${GLFW_LIB} GL GLU)
# ARM needs librt linked in
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
target_link_libraries(${PROJECT_NAME} rt)
target_link_libraries(ex-replugging rt)
target_link_libraries(ex-simple rt)
target_link_libraries(ex-gui rt)
endif()
### Install ###
install(
DIRECTORY include/cflie
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
COMPONENT library)