portalex.blogg.se

Cmake set cxx flags
Cmake set cxx flags




cmake set cxx flags

Flags used by the CXX compiler during RELWITHDEBINFO builds.ĬMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG Flags used by the CXX compiler during RELEASE builds.ĬMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG Flags used by the CXX compiler during MINSIZEREL builds.ĬMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG Flags used by the CXX compiler during DEBUG builds. That command also shows other values of interest which clarify the default behavior across built types: // Flags used by the CXX compiler during all build types. I manually set many more flags for my default set than I show in the example.

cmake set cxx flags

If I modify the flags via ccmake or cmake-gui, the new options are saved to the cache and are used by the build. Flags used by the C compiler during DEBUG builds. With this logic, I have customized baseline compiler flags that show up for everyone and they match the strings found in CMakeCache.txt (and via cmake-gui). Which gives: // Flags used by the CXX compiler during DEBUG builds. The default values of CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG can be found as mentioned at: with: cmake -LAH. If you would really like to explicitly control the build flags for the debug you can also set them with cmake -DCMAKE_BUILD_TYPE=Debug O0 is not added by default to the Debug build, but -O0 is the default -O value as mentioned at: and on man gcc, so it normally doesn't matter. Which shows the GCC build commands as explained at: ĭoing that adds the -g flag as can be confirmed with: make VERBOSE=1 At invocation time, normally all that you need to make a debug build with CMake is: cmake -DCMAKE_BUILD_TYPE=Debug.






Cmake set cxx flags