[Interest] How do i copy the QML files to debug folder without adding make install?

Till Oliver Knoll till.oliver.knoll at gmail.com
Sat Jun 16 23:57:28 CEST 2012

Am 16.06.12 23:26, schrieb Mark:
> ...  The reason i'm not using make install is
> because i can't force that option through the qmake file. In Qt
> Creator i can add a make target just fine,

I actually don't know how you define a "install" target within Qt 
Creator ;) So it is well possible that...

> but that ends up in the
> local pro.user file,

... the "install" target defined within Qt Creator ends up there. So 

> not in the .pro file.

... edit the *.pro file directly (yes, that's possible - Qt Creator will 
even realise that you changed files with another editor (or within Qt 
Creator itself) and reload it.

So manually add something like:

my_resources.files = ./relative/path/to/source
my_resources.target = ./relative/path/to/destination

INSTALLS += my_resources

to your *.pro file.

> I'd be happy to use make
> install if i could somehow predefine make targets in .pro.

See above - simply do it manually :)

> Right now i
> can't (or don't know how to) thus any person that clones my git repo
> doesn't know that make install must be used for the app to work.

Off course each time you build your application within Qt Creator the 
"make install" command still *won't* get executed.

So either do that on the command line once in a while or change the 
build steps within Qt Creator:

* Go to the "Projects" tab (on the left)
* Under "Build Steps", show the "Details"
* add "install" to the "Command line arguments for make"

(I actually never tried that, because I do that on the command line - 
but it should work.)

However note that these custom build arguments/settings really go into 
your *local* pro.user file (which you indeed should *not* check in, as 
those are everyone's personal build settings). But everyone who checks 
out the project can now do a "make install" (because that target is now 
defined in the main *.pro file).

Now what should happen is that each time you build your binary within Qt 
Creator (with the usual "Build" command: CTRL + B) that it also executes 
the "install" target (because you gave that as an argument to "make").

If you only copy small files that shouldn't make a big difference in 
build time anyway. IIRC qmake will even verify whether the source file 
is newer than the target, and only then copy the files (not sure 
though), so the performance hit should be zero when you re-compile (but 
did not change the resource files you want to copy).

Does that make sense?


More information about the Interest mailing list