I have a cmake
/gcc
project in which I have enabled several warnings and the flag -Werror
.
I have noticed that some warnings are detected when I use the cmake
flag -DCMAKE_BUILD_TYPE=Release
, but they are not when I don't apply the above cmake
flag. For example, one of these warnings is:
error: ‘var_name’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
I have read here: Set CFLAGS and CXXFLAGS options using CMake that there are several CMAKE_C_FLAGS
variables for different build types, for instance, CMAKE_C_FLAGS_RELEASE
.
I have tried to apply those variables for release and debug builds, but this time none of the above detect the warnings I'm expecting.
What I'm missing?