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

For what purpose catkin_make -DCMAKE_BUILD_TYPE=Release command is used?

asked 2018-06-24 20:36:08 -0500

malgudi gravatar image

When to use or what is the purpose of catkin_make -DCMAKE_BUILD_TYPE=Release command? How it differs from catkin_make command. Thank you.

edit retag flag offensive close merge delete

Comments

1

This is a direct duplicate of at least #q294789, which was asked 4 days ago.

gvdhoorn gravatar image gvdhoorn  ( 2018-06-25 03:26:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2018-06-24 21:34:48 -0500

updated 2018-06-24 21:35:54 -0500

The CMAKE_BUILD_TYPE variable is used to specify a build type. Typically, the selected option (by default empty, but it can be Release, Debug, or some others) is used to figure out what options to use/flags to set when cmake actually calls the compiler.

In short, Release tells the compiler to do optimization and omit debug information that Debug would tell it to keep. I've seen some people recommend using -DCMAKE_BUILD_TYPE=Release for better performance.

Calling catkin_make (and not specifying a value for CMAKE_BUILD_TYPE) results in something similar to using the Debug value.

See:
https://codeyarns.com/2015/05/14/buil...
https://cmake.org/cmake/help/v3.0/var...

edit flag offensive delete link more

Comments

3

+1 to use Release for better performance. It depends on the source how much the gain is but I had cases where a release build was running around 100 times faster than a debug build. So as a rule of thumb: Always use Release except when debug symbols are explicitly needed.

Felix Widmaier gravatar image Felix Widmaier  ( 2018-10-17 02:59:21 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-06-24 20:36:08 -0500

Seen: 7,608 times

Last updated: Jun 24 '18