Mercury
Mercury

Reputation: 1965

installing qt application in a different folder

I would like to install to a qt application to INSTALL_ROOT. Currently the destination is hard coded the pro file under target.path, but I would like to get the destination when running:

make install INSTALL_ROOT=/root/parts/myapp/install

how can I access make install's command line arguments from qt's .pro script?

Upvotes: 1

Views: 791

Answers (1)

Luca Carlon
Luca Carlon

Reputation: 9996

Setting the INSTALL_ROOT variable seems to work for me. If I set target.path to /usr/local/bin I get this into the resulting Makefile from qmake:

$(QINSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)

It seems INSTALL_ROOT is prepended to target.path. So I tested with a sample app like this:

main.cpp:

#include <stdio.h>

int main(int, char**)
{
    return printf("HELLO!\n") > 0;
}

test.pro

QT += core
SOURCES += main.cpp
target.path = /
INSTALLS += target

then:

$ qmake

$ make
g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qt -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++ -o main.o main.cpp
g++ -Wl,-O1 -o test main.o   /usr/lib/libQt5Gui.so /usr/lib/libQt5Core.so -lGL -lpthread

$ INSTALL_ROOT="$PWD/out" make install
/usr/bin/qmake -install qinstall -exe test /home/luca/tmp/test/out/test
strip /home/luca/tmp/test/out/test

$ ./out/test 
HELLO!

Upvotes: 2

Related Questions