catkin icon indicating copy to clipboard operation
catkin copied to clipboard

Add support for CMake install components

Open Hugal31 opened this issue 4 years ago • 2 comments

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.

Hugal31 avatar Jul 03 '20 14:07 Hugal31

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.

dirk-thomas avatar Jul 06 '20 16:07 dirk-thomas

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}
)

Hugal31 avatar Jul 07 '20 08:07 Hugal31