ros / catkin

A CMake-based build system that is used to build all packages in ROS.
http://wiki.ros.org/catkin
BSD 3-Clause "New" or "Revised" License
321 stars 280 forks source link

Add support for CMake install components #1103

Open Hugal31 opened 4 years ago

Hugal31 commented 4 years ago

CMake's install command supports the COMPONENT keyword since at least version 3.0. Since catkin uses the install command itself to install package.xml, the .pc file and others, it would be nice to allow the user to specify the component, for example via a parameter of catkin_package.

dirk-thomas commented 4 years ago

Can you please elaborate how you would like to use that new arguments. E.g. what would you like to pass and in which cases.

Please consider to contribute a pull request for this feature idea.

Hugal31 commented 4 years ago

For instance, if I want my component to be installed in a separate component (e.g. I use CPack to package my app in multiple .deb files), I could do :

catkin_package(
    # ...
    INSTALL_COMPONENT myComponent
)

# ... somewhere in catkin cmake internal files, for instance caktin_package.xml
set(_install_component_arg)
if(PROJECT_INSTALL_COMPONENT)
    set(_install_component_arg COMPONENT ${PROJECT_INSTALL_COMPONENT})
endif()
# install package.xml
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/package.xml
    ${_install_component_arg}
    DESTINATION share/${PROJECT_NAME}
)