QTCreator文件复制到与安装输出目录 [英] QTCreator copy files to output directory with INSTALLS

查看:2973
本文介绍了QTCreator文件复制到与安装输出目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个子目录文档根目录配置在我的Qt工程。在这些目录下的文件将被复制到每当我建立/调试项目的生成目录。

I have two sub directories docroot and config in my Qt project. Files in these directories shall be copied to the build directory whenever I build / debug the project.

由于 http://stackoverflow.com/a/3991210/356726 这可以通过使用<$ C的$ C> INSTALLS ( QtDoc ),这似乎是比运行复制命令要容易得多(例如这里)。类似的方法被描述 href=\"http://stackoverflow.com/a/6776872/356726\">。

As of http://stackoverflow.com/a/3991210/356726 this is possible by using INSTALLS (QtDoc), which seems to be much easier than running copy command (e.g here). A similar approach is described here.

config.path    = $${DESTDIR}/config
config.files   = config/*
docroot.path   = $${DESTDIR}/docroot
docroot.files  = docroot/*
INSTALLS       += config docroot

然而,当我在Qt Creator中运行构建没有任何反应。这里这说,我需要运行制作安装。我能以某种方式触发/从Qt Creator的内自动每当我建立做到这一点。我需要永远是最新版本的文件。

However, when I run a build in Qt Creator nothing happens. This here says I need to run make install . Can I somehow trigger / do this from within Qt Creator automatically whenever I build. I would need always the latest version of the files.

编辑:最后,我已经使用 $$ OUT_PWD 而不是 $$ DESTDIR

Eventually I have used $$OUT_PWD instead of $$DESTDIR

从洛根原文评论这里
刚一说明:我用 $$ OUT_PWD 而不是 $$ DESTDIR ,使其工作作为参考 $$ OUT_PWD 是程序是建立在该文件夹, $$ PWD 是程序正在建的文件夹从 - 换句话说它是其中的​​.pro文件。

Original comment from Logan here: "Just a note: I used $$OUT_PWD instead of $$DESTDIR to make it work. For reference $$OUT_PWD is the folder that the program is built to, and $$PWD is the folder that the program is Being built from -in other words it's where the .pro file is."

推荐答案

您需要的是一个自定义生成步骤。

What you need is a custom build step.


  1. 切换为项目模式:preSS按Ctrl + 5

  2. 构建设置标签下的生成步骤点击添加生成步骤

  3. 选择从菜单中。

  4. 安装请参数:文本输入框

  1. Switch to Projects Mode: press Ctrl+5.
  2. On Build Settings tab under Build Steps click on Add Build Step.
  3. Choose Make from the menu.
  4. Write install into Make arguments: text input box.

(这里我检查这些是Qt Creator的2.4.1版本。)

(The version where I checked these is Qt Creator 2.4.1.)

这篇关于QTCreator文件复制到与安装输出目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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