Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit ad7d88b

Browse files
committed
Cleanup in mcap_vendor package
- Use `${PROJECT_NAME}` instead of confusing `mcap` for library name and exporting target, to be consistent with all other packages in ROS2. - Add export for path to the `mcap` includes and export for mcap_vendor library. It was an issue in downstream packages that `mcap/mcap.hpp` was not visible since we were not exporting path to it explicitly. - Removed test section with linters for `mcap_vendor` package. Since package itself doesn't contain any tests and we shouldn't run linters on any third party code. Prevent CI failures. Signed-off-by: Michael Orlov <[email protected]>
1 parent fcd2564 commit ad7d88b

File tree

2 files changed

+14
-30
lines changed

2 files changed

+14
-30
lines changed

mcap_vendor/CMakeLists.txt

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.5)
22
project(mcap_vendor LANGUAGES C CXX ASM)
33

4+
## Dependencies
5+
find_package(ament_cmake REQUIRED)
6+
find_package(zstd_vendor REQUIRED)
7+
find_package(zstd REQUIRED)
8+
49
## Compile options
510
if(NOT CMAKE_CXX_STANDARD)
611
set(CMAKE_CXX_STANDARD 17)
@@ -11,12 +16,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1116
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
1217
endif()
1318

14-
## Dependencies
15-
find_package(ament_cmake REQUIRED)
16-
find_package(zstd_vendor REQUIRED)
17-
find_package(zstd REQUIRED)
18-
19-
2019
## Define vendor macro
2120
macro(build_mcap_vendor)
2221
include(FetchContent)
@@ -35,48 +34,37 @@ macro(build_mcap_vendor)
3534
file(GLOB _lz4_srcs
3635
${lz4_SOURCE_DIR}/lib/*.c)
3736

38-
add_library(
39-
mcap SHARED
37+
add_library(${PROJECT_NAME} SHARED
4038
src/main.cpp
4139
${_lz4_srcs}
4240
)
4341

4442
set(_mcap_include_dir ${mcap_SOURCE_DIR}/cpp/mcap/include)
4543

46-
target_include_directories(mcap SYSTEM PRIVATE
44+
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
4745
${lz4_SOURCE_DIR}/lib
4846
)
49-
target_include_directories(mcap SYSTEM PUBLIC
47+
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
5048
"$<BUILD_INTERFACE:${_mcap_include_dir}>"
5149
"$<INSTALL_INTERFACE:include>"
5250
)
5351
ament_target_dependencies(mcap zstd)
5452

5553
install(
56-
DIRECTORY
57-
${_mcap_include_dir}/mcap
58-
DESTINATION
59-
${CMAKE_INSTALL_PREFIX}/include
54+
DIRECTORY ${_mcap_include_dir}/mcap
55+
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
6056
)
6157

62-
install(TARGETS mcap EXPORT export_mcap)
58+
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME})
6359
endmacro()
6460

6561
## Call vendor macro
6662
build_mcap_vendor()
6763

68-
ament_export_targets(export_mcap HAS_LIBRARY_TARGET)
69-
64+
ament_export_include_directories(${_mcap_include_dir})
65+
ament_export_libraries(${PROJECT_NAME})
66+
ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
7067
ament_export_dependencies(zstd_vendor zstd)
7168

72-
## Tests
73-
if(BUILD_TESTING)
74-
find_package(ament_lint_auto REQUIRED)
75-
list(APPEND AMENT_LINT_AUTO_EXCLUDE
76-
ament_cmake_uncrustify
77-
)
78-
ament_lint_auto_find_test_dependencies()
79-
endif()
80-
8169
## Package
8270
ament_package()

mcap_vendor/package.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
<depend>zstd_vendor</depend>
1414

15-
<test_depend>ament_cmake_clang_format</test_depend>
16-
<test_depend>ament_lint_auto</test_depend>
17-
<test_depend>ament_lint_common</test_depend>
18-
1915
<export>
2016
<build_type>ament_cmake</build_type>
2117
</export>

0 commit comments

Comments
 (0)