How do I stop Qt Creator by putting my executable in the "debug" subdirectory?
I'm creating a project in Qt Creator, and while I don't care where intermediate .obj files are essential, the final executable is placed (and run) in a specific directory where there are many dependent DLLs, etc ..
So, in Qt Creator I select the "Shadow Build" option and specify the path to this directory.
However, I always find that instead of being placed in that directory, the final executable is always placed in
the_Directory_I_Actually_Want/debug
... this is useless to me because when I try to run or debug the program from Qt Creator, it won't start because the DLLs it depends on are in the_Directory_I_Actually_Want
, not in a subdirectory /debug
.
I tried setting DESTDIR
in my .pro file for the_Directory_I_Actually_Want, and I tried to set TARGET in my .pro file to the_Directory_I_Actually_Want/projectName
, and I tried to go overboard with various options that are part of the "kit" config and nothing seems to let me control this.
Is there a way to do this, or will I have to change the rest of my build system just for the benefit of Qt Creator?
source to share
On Windows, you can use a variable DLLDESTDIR
that indicates where to copy the target DLL or EXE. Just add this to your .pro:
CONFIG(release, debug|release): DLLDESTDIR += $$PWD/../exec
On Linux, you can use a variable QMAKE_POST_LINK
that contains the command to execute after you concatenate the TARGETs together. So, it's like:
CONFIG(release, debug|release): QMAKE_POST_LINK += $$quote(cp project $$PWD/../exec)
Here project
is the name of the target file that you provideTARGET = project
They will copy the executable binary to a directory named exec
one level higher than the program's working directory. You can have an arbitrary path.
source to share