Ask Your Question

Revision history [back]

You'll want to look into Catkin's CFG_EXTRA feature.

See How to export non-standard include directories in catkin? for an answer by @William that explains how to do this (this deals with include directories specifically, but the principle is the same. Just place an add_definitions(..) in your extras file, and be careful with PROJECT_SOURCE_DIR, as it may not have the same value (or be even defined) in the devel and install spaces).

Btw: using (ROS) parameters is a bit more flexible than using hard-coded, compile time constants, as it allows you to specify the location of things using a bit of configuration. That would also remove the need for exporting the define. If you have the option (ie: this is not a completely stand-alone library that is supposed to work without ROS), I'd use that.