ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Option 0 is not recommended in catkin because if you use catkin_make which builds all packages in a single CMake context one package would override the global flags for all others. Different packages could even set different global flags. Also setting the flags should not overwrite other flags - therefore you should always extend the flags.

Option 1 sets the flags on a per-target base which is good. As long as you code only needs C++11/14 during compilation but doesn't require a C++11/14 compiler in the headers that is perfect.

But as soon as your package headers require a newer C++ compiler your package needs to "export" that information to downstream packages so that when they are being built can make sure to use the right flags. And then you again run into the same problem that multiple packages might require different compilers.

Because of these issues a Linux distribution usually picks one specific version of the compiler to build all packages of the distribution. That makes it more predictable what features are available across all package compilations. But they resolve the compiler flags necessary to build a specific package manually and don't rely on each package to export its requirements to downstream packages.