I use CMake to create unix makefiles. After that, I compile the project using the make utility. The problem is that I do not see any warnings! For example, this leads to a clean build without warning:
Unused and lossy variables - no warnings! My CMakeLists.txt file is minimalistic:
cmake_minimum_required(VERSION 2.8) add_executable(main main.cpp)
When I run CMake and then make my output looks like this:
[100%] Building CXX object CMakeFiles/main.dir/main.cpp.o Linking CXX executable main [100%] Built target main
But when I add this line of code:
#warning ("Custom warning")
Result
contains a warning:
[100%] Building CXX object CMakeFiles/main.dir/main.cpp.o ../src/main.cpp:15:2: warning: #warning ("Custom Warning") [-Wcpp] Linking CXX executable main [100%] Built target main
I am using Ubuntu 12.04 LTS and GCC as a compiler. Perhaps CMake passes some flag to the compiler, which leads to the absence of warnings. How can I check this? I can not read make files created by CMake, they are a little cryptic.
gcc cmake
Lazin Jan 09 '13 at 8:46 2013-01-09 08:46
source share