I have several libraries that have dependencies among themselves, and one project that depends on these libraries. The build is organized using qmake.

I would like to provide automatic placement after the assembly of binary files of these libraries (cross-platform, for windows and unix) in the ways where dependent projects are waiting for them. Need support relative paths.

As I found out, qmake can do the installation on the specified path in this way:

target.path=$${PWD}/../relative/path/to/install INSTALLS+=target 

But the problem is that it is impossible to set several paths for the target (like dlltarget ) - as a result, qmake generates a Makefile in which the reassigned targets are obtained, as a result, only one path is used (the last one specified). That is, the only way to install the problem is solved, but with several - no.

How to solve a problem through qmake?

UPD

My solution to the answer @JK_Action is as follows:

 target1.path=$${PWD}/../relative/install/path/for/depependend/project/1 unix:target1.files=$${DESTDIR}/*.so* win32:target1.files=$${DESTDIR}/*.dll target2.path=$${PWD}/../relative/install/path/for/depependend/project/2 unix:target2.files=$${DESTDIR}/*.so* win32:target2.files=$${DESTDIR}/*.dll target3.path=$${PWD}/../relative/install/path/for/depependend/project/3 unix:target3.files=$${DESTDIR}/*.so* win32:target3.files=$${DESTDIR}/*.dll INSTALLS += target1 target2 target3 
  • Is the main project and project organized by the SUBDIRS template? - JK_Action
  • No, now they are in different project files. It is assumed that the main project uses libraries in the form of header and binary files, project files are not included. - ASten
  • I tried using QMAKE_EXTRA_TARGETS, creating additional goals, but did not find how to correctly set the newtarget.commands for installation (how to get the names of compiled binary files for transfer, for example, to cp for unix{ ... } or copy for win32{ ... } ). - ASten
  • How to remove syntax highlighting here? After / * the text is clearly perceived as a comment. - ASten

1 answer 1

I have a similar problem with library dependencies. The mechanism for resolving dependencies http://doc.qt.io/qt-5/qmake-advanced-usage.html came across. Alas, the hands never got to figure it out. A temporary solution to the value of everything in one direction for the platform, for this purpose I add variables to mkspec:

 PLATFORM=x64 INSTALL_PATH=/path/to/install/$$PLATFORM. 

About two ways not really understood. In INSTALL you can add a bunch of targets:

 target1.files=$$TARGET target1.path=$$INSTALL_PATH/bin target2.files=$$TARGET target2.path=$$INSTALL_PATH/lib target3.files=<dll?> target3.path=$$INSTALL_PATH/lib INSTALL += target1 target2 target3 
  • Your advice worked, strangely, I kind of tried it the same way, but broke off, I suspect that because I used besides target1, I also simply target, but it was probably tied to the original project. In general, my solution looks like this: target1.path=$${PWD}/../relative/install/path/1 unix:target1.files=$${DESTDIR}/*.so* win32:target1.files=$${DESTDIR}/*.dll target2.path=$${PWD}/../relative/install/path/2 unix:target2.files=$${DESTDIR}/*.so* win32:target2.files=$${DESTDIR}/*.dll INSTALLS += target1 target2 - ASten