forked from norlab-ulaval/libnabo
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCatkinBuild.cmake
107 lines (96 loc) · 2.04 KB
/
CatkinBuild.cmake
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
# Set compiler flags
set(CMAKE_CXX_STANDARD 17)
add_compile_options(-Wall -Wextra -Wpedantic -Werror=return-type)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-O3)
endif(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
# Find catkin macros and libraries
find_package(catkin REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS python)
# Catkin package macro
catkin_package(
INCLUDE_DIRS
nabo
${CMAKE_SOURCE_DIR}
${EIGEN3_INCLUDE_DIR}
LIBRARIES
nabo
DEPENDS
Boost
)
########################
## Library definition ##
########################
# Nabo
add_library(nabo
${NABO_SRC}
${NABO_HEADERS}
)
target_include_directories(nabo
PUBLIC
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/nabo
SYSTEM
${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
target_link_libraries(nabo
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
#############
## Install ##
#############
install(
TARGETS
nabo
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(
DIRECTORY
${CMAKE_SOURCE_DIR}/nabo/
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/nabo
)
##########
## Test ##
##########
if(CATKIN_ENABLE_TESTING)
catkin_add_gtest(test_nabo
tests/empty_test.cpp
)
target_include_directories(test_nabo
PRIVATE
${CMAKE_SOURCE_DIR}/nabo
${CMAKE_SOURCE_DIR}/tests
SYSTEM
${EIGEN3_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
)
target_link_libraries(test_nabo
gtest_main
nabo
)
##################
# Code_coverage ##
##################
find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
test_nabo
)
endif()
endif()
#################
## Clang_tools ##
#################
find_package(cmake_clang_tools QUIET)
if(cmake_clang_tools_FOUND)
add_default_clang_tooling(
DISABLE_CLANG_FORMAT
)
endif(cmake_clang_tools_FOUND)