如何阻止 Qt Creator 将我的可执行文件放入“调试"中?子目录? [英] How do I stop Qt Creator placing my executable in a "debug" subdirectory?

查看:40
本文介绍了如何阻止 Qt Creator 将我的可执行文件放入“调试"中?子目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Qt Creator 中构建一个项目,虽然我不关心中间 .obj 文件的去向,但重要的是将最终的可执行文件放入(并从)一个特定目录中,其中有许多依赖 DLL 等. 将被发现.

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.

因此,在 Qt Creator 中,我选择了Shadow Build"选项并指定了该目录的路径.

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

...这对我没有用,因为当我尝试从 Qt Creator 中运行或调试程序时,它不会启动,因为它依赖的 DLL 都在 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.

我尝试将 .pro 文件中的 DESTDIR 设置为 the_Directory_I_Actually_Want,并且尝试将 .pro 文件中的 TARGET 设置为 the_Directory_I_Actually_Want/projectName,并且我试过摆弄作为套件"配置一部分的各种选项,但似乎没有什么能让我对此有任何控制权.

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.

有没有办法做到这一点,还是我必须为了 Qt Creator 的利益而改变构建系统的其余部分?

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?

推荐答案

三年后...
只需使用:

Three years later...
Just use:

CONFIG -= \
        copy_dir_files \
        debug_and_release \
        debug_and_release_target

这篇关于如何阻止 Qt Creator 将我的可执行文件放入“调试"中?子目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆