You can add compiler flags in CMake by adding the following command to your CMakeLists.txt:
list( APPEND CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
Question
I'm using Kdevelop for a simple C++ project. I know that Kdevelop uses CMake to build the project, but the only thing that I known about CMake is that if I add a new .cpp
source file in my project, I have to add it also in CMakeLists.txt
.
Now I'm trying to enable tha gcc
compiler warnings (i.e. compiling with g++ -Wall ...
).
Does Kdevelop have a compiler settings section, or I have to edit directly the Makefile
or another CMake settings file?
Solution
You can add compiler flags in CMake by adding the following command to your CMakeLists.txt:
list( APPEND CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")