How can the install path be set for a qt project

2019-06-18 12:19发布

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?

Thanks!

标签: qt qt-creator
2条回答
我想做一个坏孩纸
2楼-- · 2019-06-18 12:43

For me, it seems that qmake PREFIX=/usr/local doesn't work (try with the source of qtcreator)

So the solution is to use qmake normally, but then, you do

make
INSTALL_ROOT=/usr/local make install
查看更多
我想做一个坏孩纸
3楼-- · 2019-06-18 12:48

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

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

qmake PREFIX=/usr/local

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.

查看更多
登录 后发表回答