-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
79 lines (71 loc) · 2.16 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
cmake_minimum_required(VERSION 3.10)
#
# Choosing to build the unittest (Catkin vs Modern CMake vs Ament).
#
if(DEFINED CATKIN_ENABLE_TESTING)
set(BUILD_TESTING ${CATKIN_ENABLE_TESTING})
endif()
#
# Project definition
#
project(linear_feedback_controller_msgs LANGUAGES CXX)
#
# Dependencies
#
find_package(Eigen3 REQUIRED)
find_package(catkin REQUIRED COMPONENTS std_msgs sensor_msgs geometry_msgs
eigen_conversions message_generation)
#
# Generate the messages
#
add_message_files(DIRECTORY msg FILES Contact.msg Control.msg Sensor.msg)
generate_messages(DEPENDENCIES std_msgs sensor_msgs geometry_msgs)
#
# Export as catkin package (For ROS1 compatibility...).
#
# cmake-format: off
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS std_msgs sensor_msgs geometry_msgs message_runtime eigen_conversions
DEPENDS EIGEN3)
# cmake-format: on
#
# Main lib.
#
set(${PROJECT_NAME}_HEADERS include/${PROJECT_NAME}/eigen_conversions.hpp)
set(${PROJECT_NAME}_SOURCES "")
add_library(${PROJECT_NAME} INTERFACE)
target_link_libraries(
${PROJECT_NAME}
INTERFACE Eigen3::Eigen ${std_msgs_LIBRARIES} ${sensor_msgs_LIBRARIES}
${eigen_conversions_LIBRARIES} ${geometry_msgs_LIBRARIES}
${message_generation_LIBRARIES})
target_include_directories(
${PROJECT_NAME} SYSTEM
INTERFACE ${std_msgs_INCLUDE_DIRS} ${sensor_msgs_INCLUDE_DIRS}
${eigen_conversions_INCLUDE_DIRS} ${geometry_msgs_INCLUDE_DIRS}
${message_generation_INCLUDE_DIRS})
target_include_directories(
${PROJECT_NAME}
INTERFACE $<INSTALL_INTERFACE:include/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
#
# Unit tests
#
if(BUILD_TESTING)
catkin_add_gtest(test_eigen_conversions tests/test_eigen_conversions.cpp
tests/gtest_main.cpp)
target_link_libraries(test_eigen_conversions ${PROJECT_NAME})
endif()
#
# Install
#
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(FILES package.xml DESTINATION share/${PROJECT_NAME})
install(
DIRECTORY include/${PROJECT_NAME}
DESTINATION include
PATTERN "third_party" EXCLUDE)