C++ Clion 2016.3:切换到“发布”配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41116797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Clion 2016.3: switch to "Release" configuration
提问by Felix
I updated to clion 2016.3 recently and noticed that I cannot choose between different configuration types anymore. With 2016.2 I had the choice between "Debug", "Release", "MinSizeRel" and "RelWithDebInfo", but now the only available option is "Debug".
我最近更新到 clion 2016.3 并注意到我不能再在不同的配置类型之间进行选择了。在 2016.2 中,我可以在“Debug”、“Release”、“MinSizeRel”和“RelWithDebInfo”之间进行选择,但现在唯一可用的选项是“Debug”。
Am I doing something wrong? Do I have to edit CMakeLists.txt in order to get different configuration types back?
难道我做错了什么?我是否必须编辑 CMakeLists.txt 才能恢复不同的配置类型?
回答by nastasiak2512
CMake workflow changedin 2016.3. Read the linked blog post for details, but in a nutshell CLion no longer builds all 4 CMake configurations to save time and memory. You can configure the CMake configuration type in Settings | Build, Execution, Deployment | CMake.
CMake 工作流程在 2016.3 中发生了变化。阅读链接的博客文章了解详细信息,但简而言之,CLion 不再构建所有 4 个 CMake 配置以节省时间和内存。您可以在 Settings | 中配置 CMake 配置类型。构建、执行、部署 | 制作。
However, understanding that some of the users really used this kind of switch quite often and don't want to change CMake settings (and thus wait for CMake reload) each time, we are going to introduce a reworked ability to add extra CMake configurations. This will be on air together with 2016.3.* update (but not 2016.3.1).
然而,了解一些用户确实经常使用这种开关并且不想每次都更改 CMake 设置(从而等待 CMake 重新加载),我们将引入重新设计的功能以添加额外的 CMake 配置。这将与 2016.3.* 更新(但不是 2016.3.1)一起播出。
回答by KeksArmee
As of CLion 2017.2 you can edit idea/workspace.xml
to restore the old workflow.
从 CLion 2017.2 开始,您可以编辑idea/workspace.xml
以恢复旧的工作流程。
Add the Release configuration (<configuration CONFIG_NAME="Release" />
) in the configurations block so it looks like this:
<configuration CONFIG_NAME="Release" />
在配置块中添加发布配置 ( ),如下所示:
<component name="CMakeSettings">
<configurations>
<configuration CONFIG_NAME="Debug" />
<configuration CONFIG_NAME="Release" />
</configurations>
</component>
Now you can switch again.
现在您可以再次切换。
回答by Laudian
For newer versions: Go to Settings --> Build, Execution, Deployment --> CMake. Now click the "+" symbol, this should automatically add a Release profile (and, if you press "+" again, a Release with Debug Information profile).
对于较新版本:转到设置 --> 构建、执行、部署 --> CMake。现在单击“+”符号,这应该会自动添加一个发布配置文件(如果再次按“+”,则会添加带有调试信息的发布配置文件)。
After this, you can switch between Release and Debug in the Configurations section in the top-right of the window.
之后,您可以在窗口右上角的“配置”部分中在“发布”和“调试”之间切换。
回答by Alone
Give you a solution in cmake-gui:
Please check the "CMAKE_CONFIGURATION_TYPES" option
在cmake-gui中给你一个解决方案:请勾选“CMAKE_CONFIGURATION_TYPES”选项
If not find the option,select the "Advanced" option.
如果没有找到该选项,请选择“高级”选项。