sbabbi
sbabbi

Reputation: 11181

Qmake get the target output file path

I have a qmake project that looks like this:

TEMPLATE = lib
CONFIG += dll
TARGET = mydll

SOURCES += ...
HEADERS += ....

Now I want to add an INSTALLS section, so I have:

target.path = /path/to/somedir/
target.files =./$$TARGET

INSTALLS+= target

Unfortunately this will not work, because $$TARGET contains the target name, and not the output file name. Is there a portable way to obtain the output file name? (Please no platform dependent string concatenation like lib + $$TARGET + .so)

Upvotes: 4

Views: 2982

Answers (1)

svlasov
svlasov

Reputation: 10456

You don't have to specify target.files, target is a special case and it's predefined in qmake.

http://qt-project.org/doc/qt-4.8/qmake-environment-reference.html#installs

If you append a built-in install set to the INSTALLS variable and do not specify files or extra members, qmake will decide what needs to be copied for you. Currently, the only supported built-in install set is target:

target.path = /usr/local/myprogram
INSTALLS += target

In the above lines, qmake knows what needs to be copied, and will handle the installation process automatically.

Upvotes: 2

Related Questions