QtCreator 4和CMake参数 [英] QtCreator 4 and CMake parameters

查看:291
本文介绍了QtCreator 4和CMake参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前使用QtCreator打开基于CMake的C ++项目,并在配置项目时传递自定义的CMake命令行参数。在最新版本的QtCreator(确切地说是QtCreator 4)中,这似乎不再可行-QtCreator使用自己的CMake变量集及其默认值配置项目。这非常烦人,因为更改某些CMake变量的值的唯一方法是单击项目并逐个修改变量,这确实很繁琐。我在文本文件中具有特定计算机的配置参数和该计算机上的设置,可以将其粘贴到Qtcreator的配置对话框中,然后运行CMake,但此对话框现在消失了。您知道在打开新项目时是否存在传递自定义CMake值的方法吗?

I used to open a CMake-based C++ project with QtCreator and pass my custom CMake command line parameters when configuring the project. In the recent versions of QtCreator (QtCreator 4 to be precise), this does not seem to be possible anymore - QtCreator configures the project with its own set of CMake variables and their default values. This is extremely annoying, because the only way to change the values of certain CMake variables is to click on 'Projects' and modify the variables one by one, which is really tedious. I have the configuration parameters for specific machine and setup on that machine in a text file that I could just paste in the configuration dialog of Qtcreator and then run CMake, but this dialog now disappeared. Do you know if there's a way of passing custom CMake values while opening a new project?

我试图清理构建目录,请从源代码中删除CMakeLists.txt.user。树,使用我的参数运行CMake,然后使用QtCreator打开项目。不幸的是,QtCreator忽略了缓存的值并生成了自己的缓存值。

I tried to clean the build directory, remove CMakeLists.txt.user in the source tree, run CMake with my parameters and then open the project with QtCreator. Unfortunately, QtCreator ignores the cached values and generates its own ...

推荐答案

工具> 选项> 构建并运行 您的套件> CMake配置

添加一行并重建。您也可以使用 Ctrl + 5 (项目模式)>管理工具包...的简短方式。

Add a line and rebuild. You can go the short way Ctrl+5 (Projects mode) > "Manage Kits...", too.

这篇关于QtCreator 4和CMake参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆