Qt project files and PREFIX variable

10,689

Solution 1

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

Solution 2

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

Share:
10,689

Related videos on Youtube

hytromo
Author by

hytromo

Updated on June 09, 2022

Comments

  • hytromo
    hytromo about 2 years

    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?

  • John Doe
    John Doe about 4 years
    Why use the manually defined PREFIX variable when there is a standard INSTALL_ROOT for this? They serve the same purpose, don't they? Or maybe I'm missing something?
  • Tatu Lahtela
    Tatu Lahtela about 4 years
    This allows you to change the default INSTALL_ROOT plus cross platform issues. You can look at this question for example for details. Note that this is almost a decade ago so times might have changed.