INSTALLS Paths/Files Cannot Be Empty ?
-
Hi all,
Trying to define some installation (make install) steps for my project but got stuck in one point. There is a .pro file which gathers all the sub-projects together by using SUBDIRS. Here is the main idea,
- All sub-projects will put their builds under $main_project_path/sub_project_path/output/binary/
- After a successful build, all outputs will be copied under $main_project_path/output/ folder.
So I wrote following lines in the SUBDIR template .pro file.
public_builds.path = $$PWD/output/ public_builds.files += "$$PWD/projects/sub-project-1/output/binary/*" public_builds.files += "$$PWD/projects/sub-project-2/output/binary/*" INSTALLS += public_builds
Then I ran qmake, make and make install commands but the make install was failed. I ran qmake again without calling make clean, then ran the make install and it started working.
I saw that, if the public_builds.files are not existing, qmake does not populate corresponding install lines in Makefile. The output files are being created after building the project, this is why it was worked on the 2. time when I run qmake after building.
Is there any way to force the qmake to add install paths into the Makefile even the directories are empty?
-
I think you should rather put the binary copying code in your subprojects. You can write it once, put into some .pri file and then
include()
in each subproject - should work. -
Yep, it is working, I tested it. Isn't it possible to make it in the template pro file?
-
@canavaroski said in INSTALLS Paths/Files Cannot Be Empty ?:
Yep, it is working, I tested it. Isn't it possible to make it in the template pro file?
I don't see such option at the moment, but maybe I'm missing something.
-
Can you explain why this is happening? Or at least can you refer any technical document?
-
@canavaroski said in INSTALLS Paths/Files Cannot Be Empty ?:
Can you explain why this is happening? Or at least can you refer any technical document?
Why what is happening? Why you need to build your project twice?
The installation target is run when you compile (
make
) your project. But the Makefile is generated before that - when you runqmake
. So at the timeqmake
is run, the files don't exist (the '*' wildcard does not match anything) and qmake skips it.INSTALLS
command docs are here https://doc.qt.io/qt-5/qmake-advanced-usage.html#installing-files not sure if they will help with anything here, though. -
So how "INSTALLS" works when I put it into the .pro file of the subproject instead of the template .pro file? Isn't qmake work in the same way? There will be no binary file at the time qmake works and they will be created after the compilation finishes and make install should fail.
-
@canavaroski said in INSTALLS Paths/Files Cannot Be Empty ?:
So how "INSTALLS" works when I put it into the .pro file of the subproject instead of the template .pro file? Isn't qmake work in the same way? There will be no binary file at the time qmake works and they will be created after the compilation finishes and make install should fail.
Indeed. I suppose the subdirs template handling in qmake just does not take it into account. You may suggest a change on Qt bugtracker, but it almost certainly won't be fixed (qmake is not actively developed anymore, only kept alive).