Make project findable by non-ROS CMakeLists

asked 2018-02-02 03:25:01 -0500

heuristicus gravatar image

I have a package (let's say it's called my_project) in a catkin workspace which creates a library that I would like to be able to find_package in other non-ROS cmake projects. By default the various cmake files are created in

my_ws/devel/.private/my_project/share/my_project/cmake/my_projectConfig-version.cmake
my_ws/devel/.private/my_project/share/my_project/cmake/my_projectConfig.cmake
my_ws/devel/share/my_project/cmake/my_projectConfig-version.cmake
my_ws/devel/share/my_project/cmake/my_projectConfig.cmake

I have tried adding the following install rules (not at the same time) to the CMakeLists of my_project to export these to /usr/local/share/my_project, but it doesn't seem to work:

install(FILES ${CATKIN_DEVEL_PREFIX}${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/${PROJECT_NAME}Config.cmake
  ${CATKIN_DEVEL_PREFIX}${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/${PROJECT_NAME}Config-version.cmake
  DESTINATION /usr/local/share/${PROJECT_NAME})
install(DIRECTORY ${CATKIN_DEVEL_PREFIX}${CATKIN_PACKAGE_SHARE_DESTINATION}
  DESTINATION /usr/local/share)

What is the correct way to install these files so that I can use find_package from non-ROS CMakeLists files?

edit retag flag offensive close merge delete