qt项目如何设置安装路径 [英] How can the install path be set for a qt project

查看:53
本文介绍了qt项目如何设置安装路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 qmake 寻找相当于 ./configure --prefix= 的东西.基本上,我想覆盖默认的安装/部署目录.这是如何用命令行 qmake 指定的?我还使用 QtCreator 构建了很多我的 gui 项目,我想知道如何在 QtCreator 内部构建时做同样的事情.是否有我可以在 .pro 文件中操作的变量来执行此操作,或者我是否可以更改我的项目设置?

I'm looking for the equivalent to ./configure --prefix= for qmake. Basically, I want to override the default install/deployment directory. How is this specified with command line qmake? I also use QtCreator to build a lot of my gui projects, and I'd like to know how to do the same thing while building inside of QtCreator. Is there a variable that I can manipulate in the .pro files to do this, or do I change my project settings?

谢谢!

推荐答案

我已经找到了解决方案,只需指定 --prefix 选项进行配置即可.

I've found the solution to this, and it is just as easy as specifying the --prefix option to configure.

对于命令行上的 qmake,您只需添加一个 PREFIX= 参数:

For qmake on the command line, you simpy add a PREFIX= parameter:

qmake PREFIX=/usr/local

在 QtCreator 中有两种方法可以做到这一点.首先,您可以更改 .pro 文件以包含显式 PREFIX 变量定义.但是,不建议这样做,因为前缀是特定于每个用户的首选项,并且最好保持分布式项目文件的通用性.更好的方法是在您自己的项目设置中.只需转到您正在使用的构建配置,展开 qmake 设置,并将 PREFIX= 添加到其他参数中.

There are two ways to do this in QtCreator. First, you could change your .pro file to include an explicit PREFIX variable definition. However, this is not recommended, as the prefix is a preference specific to each user, and it is preferable to keep the distributed project files generic. A better way to do this, is in your own project settings. Simply go to the build configuration that you are using, expand the qmake settings, and add PREFIX= to the additional arguments.

这篇关于qt项目如何设置安装路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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