Forcing use of catkin in jenkins builds
Hi,
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:
set (COMPILE_WITH_CATKIN NOT CATKIN_DEVEL_PREFIX)
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
set (COMPILE_WITH_CATKIN ENFORCE_CATKIN OR CATKIN_DEVEL_PREFIX)
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