在Kdevelop中启用编译器警告 [英] Enable compiler warnings in Kdevelop
问题描述
我正在使用Kdevelop进行简单的C ++项目。我知道Kdevelop使用CMake来构建项目,但我唯一知道的关于CMake的是,如果我在项目中添加一个新的 .cpp
源文件,我有将它添加到 CMakeLists.txt中
。
现在我试着启用 gcc
编译器警告(即编译时使用 g ++ -Wall ...
)。
Kdevelop是否有编译器设置部分,或者我必须直接编辑 Makefile
或另一个CMake设置文件?
通过向CMakeLists.txt添加以下命令,可以在CMake中添加编译器标志:
list(APPEND CMAKE_CXX_FLAGS$ {CMAKE_CXX_FLAGS} -Wall)
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?
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")
这篇关于在Kdevelop中启用编译器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!