CMAKE 3.3.2:在CMakeLists.txt中设置构建类型 [英] CMAKE 3.3.2: Set build type in CMakeLists.txt
本文介绍了CMAKE 3.3.2:在CMakeLists.txt中设置构建类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以通过CMakeLists.txt设置构建类型?这样,在我编译时无论有(或没有)生成一个新的makefile,它都应该与发布模式一起使用。我尝试以下方法:
Is there a way to set the build type from CMakeLists.txt? So that with (or without) generating a new makefile when I compile it should go with the release mode. I try something along the lines of:
set(DCMAKE_BUILD_TYPE "Release")
但是它不起作用(在调试模式下编译)。这是在linux系统上。谢谢。
But it doesn't work (compiles in debug mode). This is on a linux system. Thanks.
推荐答案
这很简单:
set(CMAKE_BUILD_TYPE "Release")
这篇关于CMAKE 3.3.2:在CMakeLists.txt中设置构建类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文