-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
108 lines (89 loc) · 2.51 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
cmake_minimum_required(VERSION 3.22)
project(covariance_geometry_ros)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
add_compile_options(-Wall -Wextra -Wpedantic -Wconversion -Wdouble-promotion -Wfloat-equal -Wshadow)
find_package(ament_cmake REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
include(ExternalProject)
find_package(Git REQUIRED)
externalproject_add(
covariance_geometry_cpp
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/covariance_geometry_cpp
GIT_REPOSITORY https://github.com/andreaostuni/covariance_geometry.git
GIT_TAG master
TIMEOUT 10
UPDATE_COMMAND ${GIT_EXECUTABLE} pull
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/covariance_geometry_cpp/src
LOG_DOWNLOAD ON
)
add_definitions(${EIGEN3_DEFINITIONS})
include_directories(
include
${EIGEN3_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/covariance_geometry_cpp/src/include
)
add_library(${PROJECT_NAME} SHARED src/covariance_geometry_ros.cpp)
target_include_directories(
${PROJECT_NAME}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>"
)
add_dependencies(
${PROJECT_NAME}
covariance_geometry_cpp
)
target_link_libraries(
${PROJECT_NAME}
${CMAKE_CURRENT_BINARY_DIR}/covariance_geometry_cpp/src/lib/libcovariance_geometry_cpp.so
)
ament_target_dependencies(
${PROJECT_NAME}
Eigen3
geometry_msgs
tf2
tf2_geometry_msgs
)
install(
TARGETS ${PROJECT_NAME}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES
DESTINATION include
)
install(DIRECTORY include/ DESTINATION include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/covariance_geometry_cpp/src/include/ DESTINATION include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/covariance_geometry_cpp/src/lib/ DESTINATION lib)
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(
Eigen3
covariance_geometry_cpp
geometry_msgs
tf2
tf2_geometry_msgs
)
if(BUILD_TESTING)
set(TEST_TARGETS
test_composition
test_conversion
)
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_gtest REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_find_gtest()
foreach(test_name ${TEST_TARGETS})
ament_add_gtest("${test_name}" "test/${test_name}.cpp")
target_link_libraries(
"${test_name}"
${PROJECT_NAME})
endforeach()
endif()
ament_package()