Qt project files and PREFIX variable

2020-02-11 04:01发布

I included

PREFIX = /usr/local

inside my project file and then I run

qmake myproject.pro

The makefile doesn't say anything about PREFIX though so I assume that i'm doing something wrong. Any ideas?

3条回答
我想做一个坏孩纸
2楼-- · 2020-02-11 04:15

That is INSTALL_ROOT variable on install, try
make install INSTALL_ROOT="your path"

查看更多
放荡不羁爱自由
3楼-- · 2020-02-11 04:16

If you like to pass PREFIX to qmake, so you can do as follow:

  • Open Projects from left pan or using Ctrl+5 key
  • Expand Build Steps
  • Add PREFIX=/your/path/ into Additional arguments field
查看更多
唯我独甜
4楼-- · 2020-02-11 04:39

PREFIX doesn't mean anything in qmake files. The target for files is done via the target parameter. So if you want to make PREFIX determine the base location, such as /usr/local, you can do do something like this:

isEmpty(PREFIX) {
 PREFIX = /usr/local
}
TARGET = myapp
TARGET.path = $$PREFIX/

The isEmpty(PREFIX) will allow it to be changed during the command line call to qmake, e.g.

qmake PREFIX=/opt
查看更多
登录 后发表回答