[CMake] Turning on warnings when compiling.

Jack Kelly endgame.dos at gmail.com
Tue Aug 28 09:27:18 EDT 2007


Michael Wagner wrote:
> Maybe somebody out there knows how to turn on warnings. (Hopefully you
> are not all fearless coders that laugh in the face of warnings... ;-)

Real Programmers(tm) don't need warnings!

For mortals like myself, here's how I do it:

Go into the CMake cache via `make edit_cache', `ccmake .' or similar 
from your build directory.

Depending on the value of CMAKE_BUILD_TYPE and the language you're 
using, the variable you'll need to set will be different:

For C, you have CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} (but in uppercase), so
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
... and so on

You could also lock down required flags by SETting the variables in 
CMakeLists.txt if you wanted.

-- Jack


More information about the CMake mailing list