Ask Your Question

Forcing use of catkin in jenkins builds

asked 2016-06-01 07:12:25 -0500

JenniferBuehler gravatar image


I have a package in which the CMakeLists.txt has to work without catkin as well (to build with cmake only). My current solution is to disable all catkin-specific commands (eg. catkin_package()) by taking them out with if statements, eg. if(COMPILE_WITH_CATKIN) ..<catkin commands> .... To set COMPILE_WITH_CATKIN I use the fact that CATKIN_DEVEL_PREFIX is defined only when building from within a catkin workspace:


This works fine in a catkin workspace and with cmake only, but there are problems when building on Jenkins, when the CATKIN_DEVEL_PREFIX is not defined, but catkin still needs to be used (especially catkin_package()). So for building on jenkins, building with catkin has to be enforced. I currently have this work-around:

set (ENFORCE_CATKIN false) # set this to true for jenkins builds ONLY

Before releasing the package with bloom, I manually set ENFORCE_CATKIN to true. Afterwards, for my source repository, I re-set it to false.

This is certainly not the prettiest solution. Is there a better way to detect when catkin commands would lead to errors (eg. catkin_package() command not found)?

Thanks for your help, Jenny

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-01 09:17:19 -0500

Dirk Thomas gravatar image

updated 2016-06-01 09:18:04 -0500

I am not sure about your use case but in CMake you can try to find catkin and then continue based on if it was found or not. Like this:

find_package(catkin)  # not passing REQUIRED
  # maybe call find_package again with COMPONENTS

You can also mix this with a custom option like COMPILE_WITH_CATKIN.

edit flag offensive delete link more


Hi Dirk,

thanks for your quick reply. I have tried this approach, however when compiling with cmake only, catkin is still found if it's installed... I'm basically looking for a way to detect when compilation is happening from within a catkin workspace/jenkins.

JenniferBuehler gravatar image JenniferBuehler  ( 2016-06-01 10:01:43 -0500 )edit

The use case is a couple of packages which should compile without catkin as well. They are general packages which are also used in projects outside ROS. I'd like to be able to put the package in a catkin workspace to compile as normal, and also be able to build with cmake separately.

JenniferBuehler gravatar image JenniferBuehler  ( 2016-06-01 10:03:25 -0500 )edit

There is no distinguishing variable or anything else which lets you decide how CMake was being invoked. You could invert the logic and pass COMPILE_WITHOUT_CATKIN if catkin is on your CMAKE_PREFIX_PATH but you don't want to use it.

Dirk Thomas gravatar image Dirk Thomas  ( 2016-06-01 10:18:56 -0500 )edit

That is also a good idea, thanks! Will try this next time. For now, my approach works, I just wanted to know if there's a nicer way to achieve it. Thanks for your help!

JenniferBuehler gravatar image JenniferBuehler  ( 2016-06-01 10:55:33 -0500 )edit

We can't provide a public way (without authentication and authorization) to trigger builds on the farm. That would very likely result in abuse.

Dirk Thomas gravatar image Dirk Thomas  ( 2016-06-01 11:14:29 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2016-06-01 07:12:25 -0500

Seen: 498 times

Last updated: Jun 01 '16