ros / geometry2

A set of ROS packages for keeping track of coordinate transforms.
189 stars 275 forks source link

tf2_py build failure with catkin symlink install #486

Open dgoel opened 3 years ago

dgoel commented 3 years ago

tf2_py project errors out when building with symlink install option for catkin with catkin-tools (or colcon). This does not happen if symlink option is not enabled.

The main cause is that catkin does not handle cmake generator expression in the install functions for cmake. Nevertheless, proposing a fix here.

Version(s) affected

I have only tested with melodic-devel but this should also affect noetic-devel.

How to reproduce

With ros melodic distro:

# clone
$ mkdir -p ros_ws/src
$ cd ros_ws
$ git clone https://github.com/ros/geometry2 src

# build
$ catkin init
$ catkin config --install --cmake-args -DCATKIN_SYMLINK_INSTALL:BOOL=ON
$ catkin build

Build error:

CMake Error at catkin_symlink_install/catkin_symlink_install.cmake:157 (message):
  catkin_symlink_install_files() can't find
  '/home/user/ros_ws/src/tf2_py/$<TARGET_FILE:tf2_py>'
Call Stack (most recent call first):
  catkin_symlink_install/catkin_symlink_install.cmake:343 (catkin_symlink_install_files)
  cmake_install.cmake:41 (include)

make: *** [install] Error 1

Proposed fix

This can be fixed by not using cmake generator expression in the install as follows:

$ git diff
diff --git a/tf2_py/CMakeLists.txt b/tf2_py/CMakeLists.txt

-install(FILES $<TARGET_FILE:tf2_py>
+install(TARGETS tf2_py
     DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}
 )

I am happy to open a PR if this is acceptable.

mqcmd196 commented 5 months ago

+1