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

CMake: How to compile each node with a specific flag

asked 2018-04-29 06:37:09 -0500

mohsen gravatar image

I think this is really a CMake question. Let's say I want to compile the source for node 1, 2 and 3 with -pthread, -O3 and -Os flags respectively. How should I specify this in CMakeLists.txt and/or catkin_make command?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-04-29 08:31:26 -0500

Yes you can you the set_target_properties command to set many things including compiler flags just for one target.

You would add:

set_target_properties(<your_binary> PROPERTIES COMPILE_FLAGS "<your custom flags>" )

See the CMake documentation for more details.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-04-29 06:37:09 -0500

Seen: 1,218 times

Last updated: Apr 29 '18