Ask Your Question
0

Using colcon, is there a way to skip a "top" CMakeLists.txt and detect packages in sub-folders?

asked 2020-02-25 12:47:37 -0500

I have the following file structure with a mix of legacy code and some ROS packages in a single git repository:

src/top_project/CMakeLists.txt
src/top_project/sub_project1/CMakeLists.txt # no ROS
src/top_project/sub_project2/CMakeLists.txt # with ROS
src/top_project/sub_project2/package.xml

The top_project/CMakeLists.txt is provided for non ROS users and is just a list of add_subdirectory(sub_projectN). I would like colcon to ignore the top_project/CMakeLists.txt and potentially treat each sub_project as a separate package. I tried adding COLCON_IGNORE but this lead to the whole directory and subdirectories being ignored. Is there something like COLCON_IGNORE_CWD to ignore top_project but recursively search the sub folders? To note, I'm trying to port ROS1 libraries build with python catkin build tools which relied on the fact that directories without package.xml where ignored and we had to explicitly provide a package.xml for each actual package.

I'm using ROS 2 Eloquent with:

> cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

> colcon version-check 
colcon-argcomplete 0.3.3: up-to-date
colcon-bash 0.4.2: up-to-date
colcon-cd 0.1.1: up-to-date
colcon-cmake 0.2.18: up-to-date
colcon-core 0.5.3: up-to-date
colcon-defaults 0.2.3: up-to-date
colcon-devtools 0.2.2: up-to-date
colcon-library-path 0.2.1: up-to-date
colcon-metadata 0.2.3: up-to-date
colcon-notification 0.2.12: up-to-date
colcon-output 0.2.7: up-to-date
colcon-package-information 0.3.1: up-to-date
colcon-package-selection 0.2.5: up-to-date
colcon-parallel-executor 0.2.4: up-to-date
colcon-pkg-config 0.1.0: up-to-date
colcon-powershell 0.3.6: up-to-date
colcon-python-setup-py 0.2.3: up-to-date
colcon-recursive-crawl 0.2.1: up-to-date
colcon-ros 0.3.15: up-to-date
colcon-test-result 0.3.8: up-to-date
colcon-zsh 0.4.0: up-to-date
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-25 14:42:44 -0500

Dirk Thomas gravatar image

There is no option to ignore that specific file.

As a workaround - instead of using the default (recursively crawling for packages which stops at that CMake file) - you can choose a different way to discover packages:

  • If all packages are direct subdirectories of src you could call colcon with --paths src/*.
  • If you need crawl recursively under src you can pass --base-paths src/*.

Both options are described when you invoke e.g. colcon build --help.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-02-25 12:47:37 -0500

Seen: 26 times

Last updated: Feb 25