Skip to content

CMake build types

Paul-Antoine Arras edited this page Jan 10, 2019 · 2 revisions

CMakes features various predefined build types depending on the language and the implementation. They can be set through the CMAKE_BUILD_TYPE special variable.
Unfortunately, they are poorly documented. On Ubuntu 16.04, looking at /usr/share/cmake-3.5/Modules/Compiler/GNU.cmake brings some insights.
In C, there are five: None (empty string), Release, Debug, MinSizeRel and RelWithDebInfo. For GCC, it translates into the following command-line flags:

  • Release: -O3 -DNDEBUG
  • Debug: -g
  • MinSizeRel: -Os -DNDEBUG
  • RelWithDebInfo: -O2 -g -DNDEBUG

However, in SaBRe, the flags for Debug are overridden to be -ggdb3 in loader/CMakeLists.txt.

Clone this wiki locally