更改由 KDevelop 创建的默认值 CMakeLists.txt?

Change default CMakeLists.txt created by KDevelop?

当我创建项目时,我的 CMakeLists.txt 文件如下所示:

cmake_minimum_required(VERSION 2.6)
project(testttt)

add_executable(testttt main.cpp)

install(TARGETS testttt RUNTIME DESTINATION bin)

但我希望它看起来像这样:

cmake_minimum_required(VERSION 2.6)
project(testttt)

add_executable(testttt main.cpp)

install(TARGETS testttt RUNTIME DESTINATION bin)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

这样我就默认支持 C++11。我该怎么做?

KDevelop 项目模板是使用 Grantlee 模板引擎实现的。 Here is 如何添加自己的模板的手册。

内置模板位于/share/apps/kdevfiletemplates/templates,您可以以“Basic C++ project`为例。