forked from KITmedical/kacanopen
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
134 lines (120 loc) · 2.98 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
123
124
125
126
127
128
129
130
131
132
133
134
cmake_minimum_required(VERSION 2.8)
project(kacanopen)
#############
## Flags ##
#############
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
################
## Settings ##
################
# Debug
option(EXHAUSTIVE_DEBUGGING "Enable exhaustive debugging." OFF)
if(${EXHAUSTIVE_DEBUGGING})
message(STATUS "Enabled exhaustive debugging.")
add_definitions("-DEXHAUSTIVE_DEBUGGING")
endif()
##############
## Catkin ##
##############
find_package(catkin REQUIRED COMPONENTS
backward_ros
roscpp
roslib
sensor_msgs
std_msgs
)
find_package(Threads)
find_package(Boost 1.46.1 COMPONENTS system filesystem REQUIRED)
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
${PROJECT_NAME}_driver
${PROJECT_NAME}_core
${PROJECT_NAME}_master
${PROJECT_NAME}_ros_bridge
${PROJECT_NAME}_tools
CATKIN_DEPENDS
backward_ros
roscpp
roslib
sensor_msgs
std_msgs
)
#############
## Build ##
#############
include_directories(
include
${Boost_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
# Driver
file(GLOB DRIVER_SRC "src/driver/*.c")
add_library(${PROJECT_NAME}_driver SHARED ${DRIVER_SRC})
# Core
file(GLOB CORE_SRC "src/core/*.cpp")
add_library(${PROJECT_NAME}_core SHARED ${CORE_SRC})
target_link_libraries(${PROJECT_NAME}_core
${PROJECT_NAME}_driver
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
)
# Master
file(GLOB MASTER_SRC "src/master/*.cpp")
add_library(${PROJECT_NAME}_master SHARED ${MASTER_SRC})
target_link_libraries(${PROJECT_NAME}_master
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${PROJECT_NAME}_core
)
# Ros bridge
file(GLOB ROS_BRIDGE_SRC "src/ros_bridge/*.cpp")
add_library(${PROJECT_NAME}_ros_bridge SHARED ${ROS_BRIDGE_SRC})
target_link_libraries(${PROJECT_NAME}_ros_bridge
${PROJECT_NAME}_master
${catkin_LIBRARIES}
)
# Tools
file(GLOB TOOLS_SRC "src/tools/*.cpp")
add_library(${PROJECT_NAME}_tools SHARED ${TOOLS_SRC})
target_link_libraries(${PROJECT_NAME}_tools
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
)
##############
## Examples ##
##############
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_subdirectory(examples)
else()
message("\n-- Add -DCMAKE_BUILD_TYPE=Debug to build the examples.\n")
endif()
#############
## Install ##
#############
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
install(
TARGETS
${PROJECT_NAME}_driver
${PROJECT_NAME}_core
${PROJECT_NAME}_master
${PROJECT_NAME}_ros_bridge
${PROJECT_NAME}_tools
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
install(
DIRECTORY resources
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
file(GLOB SCRIPTS "scripts/*")
install(
PROGRAMS ${SCRIPTS}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)