-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
169 lines (144 loc) · 5.92 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
cmake_minimum_required(VERSION 2.8.3)
project(rcll_refbox_peer)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
rcll_ros_msgs
roscpp
tf2
)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
include(CheckCXXCompilerFlag)
# Do not do this atm, need to find llsf_msgs
#include(FindPkgConfig)
#pkg_check_modules(protobuf_comm protobuf_comm)
if (protobuf_comm_FOUND)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
else()
find_package(Fawkes COMPONENTS protobuf_comm llsf_msgs)
if (NOT Fawkes_FOUND)
find_package(RCLLRefbox COMPONENTS protobuf_comm llsf_msgs)
if (NOT RCLLRefbox_FOUND)
message(FATAL_ERROR "protobuf_comm not found, tried system, Fawkes, and RCLL refbox")
endif()
endif()
endif()
################################################
## Declare ROS dynamic reconfigure parameters ##
################################################
## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed
## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES rcll_refbox_peer
# CATKIN_DEPENDS rcll_msgs roscpp
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
## Declare a C++ library
# add_library(rcll_refbox_peer
# src/${PROJECT_NAME}/rcll_refbox_peer.cpp
# )
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(rcll_refbox_peer ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
add_executable(rcll_refbox_peer src/rcll_refbox_peer_node.cpp)
add_dependencies(rcll_refbox_peer ${catkin_EXPORTED_TARGETS})
## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(rcll_refbox_peer_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
if (protobuf_comm_FOUND)
message(STATUS "Using system protobuf_comm")
set_target_properties(rcll_refbox_peer PROPERTIES
INCLUDE_DIRECTORIES "${protobuf_comm_INCLUDE_DIRS}"
COMPILE_FLAGS "${protobuf_comm_CFLAGS}"
LINK_FLAGS "${protobuf_comm_LFLAGS}"
LINK_LIBRARIES "${protobuf_comm_LIBRARIES};${catkin_LIBRARIES}"
)
elseif (Fawkes_FOUND)
list(APPEND Fawkes_LIBRARIES "llsf_msgs")
# Use Fawkes' protobuf_comm
set_target_properties(rcll_refbox_peer PROPERTIES
INCLUDE_DIRECTORIES "${Fawkes_INCLUDE_DIRS};${catkin_INCLUDE_DIRS}"
COMPILE_FLAGS "${Fawkes_CFLAGS} ${catkin_CFLAGS}"
LINK_FLAGS "${Fawkes_LFLAGS}"
LINK_LIBRARIES "${Fawkes_LIBRARIES};${catkin_LIBRARIES}"
INSTALL_RPATH "${Fawkes_LIBRARY_DIRS}"
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH TRUE)
message(STATUS "Using Fawkes protobuf_comm")
elseif (RCLLRefbox_FOUND)
list(APPEND _LIBRARIES "rcll_msgs")
list(APPEND Fawkes_INCLUDE_DIRS "/home/robotino/rcll-refbox/src/libs/")
list(APPEND Fawkes_LIBRARIES "/home/robotino/rcll-refbox/lib/libllsf_protobuf_comm.so")
list(APPEND Fawkes_LIBRARIES "/home/robotino/rcll-refbox/lib/protobuf/librcll_msgs.so")
list(APPEND Fawkes_LIBRARIES "/home/robotino/rcll-refbox/lib/protobuf/libllsf_log_msgs.so")
list(APPEND Fawkes_LIBRARIES "/home/robotino/rcll-refbox/lib/libmps_comm.so")
list(APPEND Fawkes_LIBRARIES "/usr/lib/x86_64-linux-gnu/libprotobuf.so")
# Use Fawkes' protobuf_comm
set_target_properties(rcll_refbox_peer PROPERTIES
INCLUDE_DIRECTORIES "${Fawkes_INCLUDE_DIRS};${catkin_INCLUDE_DIRS}"
COMPILE_FLAGS "${Fawkes_CFLAGS} ${catkin_CFLAGS}"
LINK_FLAGS "${Fawkes_LFLAGS}"
LINK_LIBRARIES "${Fawkes_LIBRARIES};${catkin_LIBRARIES}"
INSTALL_RPATH "${Fawkes_LIBRARY_DIRS}"
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH TRUE)
message(STATUS "Using Fawkes protobuf_comm")
else()
message(FATAL_ERROR "Neither system nor Fawkes protobuf_comm found")
endif()
#############
## Install ##
#############
install(TARGETS rcll_refbox_peer
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# install launch files
install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/
)