Skip to content

Allow overriding installation directories to support multiarch packaging (Debian/Ubuntu) and standalone usage #1120

@wooksong

Description

@wooksong

Hi there, thanks for this amazing library!

I am currently working on packaging BehaviorTree.CPP natively for Debian/Ubuntu systems using standard Debian packaging tools (dpkg-buildpackage).

I understand that the installation paths in CMakeLists.txt might be hardcoded to ensure it builds seamlessly and consistently within the ROS/ROS2 ecosystem (e.g., ament/catkin). However, for users and system maintainers who want to use or package BehaviorTree.CPP as a standalone, general-purpose C++ library, this strict hardcoding causes some limitations.

Description

In Debian-based systems, libraries should be installed into multiarch directories like /usr/lib/x86_64-linux-gnu instead of /usr/lib/.
When configuring with CMake, I pass the argument -DBTCPP_LIB_DESTINATION=lib/x86_64-linux-gnu, but it gets overwritten during the build process because the paths are defined using normal set() commands without the CACHE option.

In CMakeLists.txt:

set(BTCPP_LIB_DESTINATION     lib)
set(BTCPP_INCLUDE_DESTINATION include)
set(BTCPP_BIN_DESTINATION     bin)

Expected behavior

It would be incredibly helpful if these destination paths could be overridden via CMake command-line arguments (e.g., -DBTCPP_LIB_DESTINATION=...) for non-ROS environments.

Suggested Solution

The most standard CMake approach would be to use the GNUInstallDirs module, which automatically handles platform-specific installation paths.

Alternatively, simply making them CACHE variables would solve the issue without breaking any existing ROS workflows:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions