7

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!

dusktreader
  • 3,845
  • 7
  • 30
  • 40

2 Answers2

7

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
Dolanor
  • 822
  • 9
  • 19
  • 1
    And it is a limit in qmake, so maybe some people have created a PREFIX variable in their .pro file, but there is no default behaviour on that. https://bugreports.qt-project.org/browse/QTBUG-12341 – Dolanor Feb 01 '12 at 10:44
  • This is the correct method to use, when a qmake project has `target.path = /path/to/somewhere/` yet you want to override it (without modifying source) – Kevin Nov 06 '15 at 17:27
5

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.

dusktreader
  • 3,845
  • 7
  • 30
  • 40
  • Note that qmake's makefile `install` target does not work and is not supported on Windows. – rubenvb Jun 02 '11 at 16:54
  • @rubenvb Thanks. I'll have to look into source deployment issues with windows. Do you have any suggestions or places to read up on that? – dusktreader Jun 02 '11 at 17:39
  • well, that's only from personal experience with Qt Creator (which I would expect to be written correctly). Can't find anything useful on Google or in the docs either, sorry. – rubenvb Jun 02 '11 at 17:48