PDA

View Full Version : Only copying files using qmake



sagacity
23rd June 2009, 15:08
I am using several 3rd party libraries in my application. Some of these are binary-only (dll's, for instance). I would like to create a "3rdparty.pro" that just copies some file across.
However, I cannot seem to create a makefile that doesn't also want to compile something.

For instance, I have created a test.pro that looks like this:



mytarget.target = output.txt
mytarget.commands = $(COPY) input.txt $$mytarget.target
mytarget.depends = input.txt

QMAKE_EXTRA_TARGETS += mytarget
POST_TARGETDEPS += output.txt


Now, it copies input.txt to output.txt correctly, so that's nice. But it will also try to compile (and link, if I don't specify CONFIG += no_link) test.cpp. How can I make a "copy-only" makefile?

I have attached a very small test project to illustrate what I would like to do.

ayoy
26th June 2009, 07:38
If you want to install files (copy them with make install), the easiest way is to have it like this:



mytarget.path = /some/output/path
mytarget.files = input.txt

INSTALLS += mytarget


If you want to just copy them somewhere, you can try:



QMAKE_POST_LINK = cp input.txt output.txt


If you have to link to the libraries, you'll probably stick to QMAKE_PRE_LINK.

sagacity
26th June 2009, 14:03
Thanks, the QMAKE_POST_LINK seems like a good bet, but that would copy the files always, instead of applying nice make rules.

The "INSTALLS" path I noticed already but, as you mention, it will only do this on 'make install', whereas I want it to be done always. But that doesn't really matter, tbh. I don't mind simply always doing a 'make install', I guess.