Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export the right library names #71

Merged
merged 5 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ target_link_libraries(realtime_circular_buffer
Boost::boost
)

# filter_base is an INTERFACE library because it only has header files.
# It is not compiled, but sets up the following properties for consumers
# to link to a target.
# For more info, see the CMake Wiki on INTERFACE targets.
# https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries
add_library(filter_base
INTERFACE
include/filters/filter_base.h
Expand Down Expand Up @@ -204,9 +209,8 @@ endif()
# Install
##############################################################################

# Export old-style CMake variables
# Export old-style CMake variables for includes
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME})

# Export modern CMake targets
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Filters

## Usage with ament_cmake

Here is recommended approach on how to link `filters` to your project, using the `filters::realtime_circular_buffer` target.

```cmake
find_package(filters CONFIG REQUIRED)

add_library(my_library)
# Other library stuff here

target_link_libraries(my_library PUBLIC filters::realtime_circular_buffer)
```

For more information on using ament_cmake,
see the [ament_cmake](https://docs.ros.org/en/rolling/How-To-Guides/Ament-CMake-Documentation.html)
tutorial.

Filters creates all of the following CMake targets, including:
* filters::realtime_circular_buffer
* filters::filter_chain
* filters::mean
* filters::params
* filters::increment
* filters::median
* filters::transfer_function

It is recommended to only link to the libraries needed.
Linking to `filters::filter_base` pulls in all necessary libraries and include directories for targets with classes that extend `FilterBase`. This is useful if you are writing your own filter.