c++ - CMAKE 3.3.2 : Set build type in CMakeLists. 文本文件

标签 c++ cmake makefile

有没有办法从 CMakeLists.txt 设置构建类型?因此,在我编译时生成(或不生成)新的 makefile 应该与 Release模式一起使用。我尝试了以下方法:

set(DCMAKE_BUILD_TYPE "Release")

但它不起作用(在 Debug模式下编译)。这是在linux系统上。谢谢。

最佳答案

很简单:

set(CMAKE_BUILD_TYPE "Release")

关于c++ - CMAKE 3.3.2 : Set build type in CMakeLists. 文本文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34558795/

相关文章:

c++ - C++代码跳过获取行语句的问题

cmake - 如何提前从 cmake 中的函数返回?

linux - Ceres make 失败 : "Makefile:138: recipe for target ' all' failed"

c++ - 窗口 : load a filter driver while windows is running

c++ - 如何确定Qt文档行的渲染高度

c++ - 将 C 和 C++ 与 CMAKE 混合

CMake : Relink directory and double linking

c - 使用 Xcode 运行和调试完整的 C 项目

linux - 错误编译 freetype make : Nothing to be done for 'unix'

c++ - 如何在 Linux 下安装 Haskell? - 官方文档中的错误?