I'm building a project in Qt Creator, and while I don't care where the intermediate .obj files go it's important that the final executable be put in (and run from) a particular directory where the many dependency DLLs etc. are to be found.
So, in Qt Creator, I select the 'Shadow Build' option and specify the path to this directory.
What I always find, however, is that instead of being put into this directory, the final executable is always placed into
the_Directory_I_Actually_Want/debug
... which is no use to me because, when I then try to run or debug the program from within Qt Creator, it won't start because the DLLs that it depends on are all in the_Directory_I_Actually_Want
and not in the /debug
subdirectory.
I've tried setting DESTDIR
within my .pro file to the the_Directory_I_Actually_Want, and I've tried setting TARGET within my .pro file to the_Directory_I_Actually_Want/projectName
, and I've tried faddling around with the various options that are part of the 'kit' configuration, and nothing seems to let me have any control over this.
Is there a way of doing this, or am I going to have to change the rest of my build system around just for Qt Creator's benefit?
On Windows you can use
DLLDESTDIR
variable which specifies where to copy the target dll or exe. Just add this to your .pro :On Linux you can use
QMAKE_POST_LINK
variable which contains the command to execute after linking the TARGET together. So it is like:Here
project
is the name of the target file which you provide byTARGET = project
These will copy the executable binary to a directory named
exec
one level upper than the program working directory. You can have your arbitrary path.Three years later...
Just use: