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

How to add additional compile flags

asked 2011-02-23 08:40:29 -0600

tom gravatar image

updated 2014-01-28 17:09:13 -0600

ngrennan gravatar image

For the ARM build of the PCL_ROS package to work I need to add some additional compiler (gcc / g++) flags. What is the right way to do it?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
5

answered 2011-02-23 08:45:28 -0600

Eric Perko gravatar image

See the rosbuild/CmakeLists docs.

In particular, the rosbuild_add_compile_flags and rosbuild_remove_compile_flags macros are likely what you want.

edit flag offensive delete link more

Comments

@Eric: I rather like marking favorite answers myself in my own questions. But of course, thanks for the help.
tom gravatar image tom  ( 2011-02-23 19:08:28 -0600 )edit
I'm trying to add flag "-finline-limit 600" to the target pcl_ros_features in the package pcl_ros. So I added a line rosbuild_add_compile_flags(pcl_ros_features -finline-limit 600) in pcl_ros/CMakeLists.txt, but I keep getting errors. I've tried adding ", leaving space out but no success. Any clues?
tom gravatar image tom  ( 2011-02-23 21:12:56 -0600 )edit
Did you try `-finline-limit=600`?
Eric Perko gravatar image Eric Perko  ( 2011-02-24 05:18:16 -0600 )edit
1

answered 2011-02-23 23:25:04 -0600

Daniel Stonier gravatar image

updated 2011-02-23 23:27:05 -0600

$ROS_ROOT/core/rosbuild/rosconfig.cmake is where ros configuration starts. There are three places ros looks for rosconfig.cmake, and if you parse rosbuild's rosconfig.cmake, you'll find it essentially does the following:

  • $ROS_ROOT/rosconfig.cmake - this is the user (global) configuration file.
  • <pkg>/rosconfig.cmake - overrides the user's configuration file for a single package.

If neither of the above are found, or not all configuration variables are set:

  • rosbuild/rosconfig.cmake finally sets some sane defaults.
edit flag offensive delete link more
0

answered 2011-02-23 12:08:35 -0600

Daniel Stonier gravatar image

If you're cross compiling and want to add cpu specific flags globally, you may want to use eric's suggestion and include them in $ROS_ROOT/rosconfig.cmake. This is neater as it is under your control and avoids hacking someone else's CMakeLists.txt files (which will disappear next time you install).

If you need it for a certain package only, then that would be the only way to go, though I'd suggest finding a way to upstream the changes so others can benefit as well.

edit flag offensive delete link more

Comments

Thanks. I think the right path is $ROS_ROOT/core/rosbuild/rosconfig.cmake (at least in Diamondback), though.
tom gravatar image tom  ( 2011-02-23 19:07:01 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-02-23 08:40:29 -0600

Seen: 4,536 times

Last updated: Feb 23 '11