Compiling PCL from source for multiple ros nodes (pcl_ros_gencfg error)

asked 2021-03-01 09:08:07 -0500

ia gravatar image

updated 2021-03-01 09:59:25 -0500

I had this exact problem when building PCL from source (in order to activate Cuda support) and the answer in that link works perfectly.

However, as soon as I introduce one additional ros node (two or more) and run: cd $ROS_WS && catkin_make && source devel/setup.bash

Unfortunately there is another issue:

add_custom_target cannot create target "pcl_ros_gencfg" because another target with the same name already exists. The existing target is a custom target created in source directory "/opt/ros_ws/src/other_ros_node_requiring_pcl". See documentation for policy CMP0002 for more details.

And if I simply do: rm -rf $ROS_WS/build and then run the catkin_make command above again it works. But each time I build I must again remove the build dir, so this feels very hacky.

I've tried googling this error, but the answer I've found seems to have no impact. It's strange this works when I am only compiling PCL alongside one other ros node that depends on it.

I have a very straight forward setup (same for both ros nodes depending on PCL):


find_package(PCL REQUIRED COMPONENTS common io)
find_package(catkin REQUIRED COMPONENTS


<?xml version="1.0"?>
<package format="2">
  <description>PCL tests</description>

  <maintainer email="">me</maintainer>




I install PCL and perception_pcl downloaded from:

edit retag flag offensive close merge delete