forked from ros2/example_interfaces
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
49 lines (40 loc) · 1.19 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
cmake_minimum_required(VERSION 3.5)
project(example_interfaces)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
set(EXCEPTION_MSG
# msg here won't be built.
)
macro(subdirlist result dir type)
file(GLOB children "${dir}/${type}")
set(filelist "")
foreach(child ${children})
get_filename_component(child ${child} NAME)
list(FIND EXCEPTION_MSG ${child} index)
if(${index} EQUAL -1)
list(APPEND filelist "${dir}/${child}")
else()
message("${child} is not supported in ros2")
endif()
endforeach()
set(${result} ${filelist})
endmacro()
subdirlist(MSG_FILES "msg" "*.msg")
subdirlist(SRV_FILES "srv" "*.srv")
subdirlist(ACT_FILES "action" "*.action")
rosidl_generate_interfaces(${PROJECT_NAME}
${MSG_FILES}
${SRV_FILES}
${ACT_FILES}
)
install(FILES mapping_rules.yaml DESTINATION share/${PROJECT_NAME})
ament_export_dependencies(rosidl_default_runtime)
ament_package()