【问题标题】:qmake INSTALL's option to install if file not exists (qt .pro option)如果文件不存在,qmake INSTALL 的安装选项(qt .pro 选项)
【发布时间】:2013-03-27 14:31:29
【问题描述】:

我正在使用 qmake 的安装选项来定义生成的 Makefile 的“make install”行为,例如在 myProject.pro 我有:

myFiles.path=/final/destination
myFiles.files=*.cfg

INSTALLS += myFiles

然后

qmake myProject.pro
make install

将所有 .cfg 文件移动到 /final/destination

现在我想将这些文件移动到 /final/destination,如果它们不存在的话。

例如,如果 /final/destination/myConf.cfg 存在,不要替换它。

是否可以在 myProject.pro 中添加一些规则?

我不想编辑 Makefile,如果可能的话,我想保留 .pro 中的所有规则。

谢谢!

【问题讨论】:

  • 最终/目的地?你看过这部电影吗?
  • 我不认为 qmake 可以做到这一点。可能是cmake可以。

标签: qt qmake


【解决方案1】:

我没有测试过,但是如果我正确理解了您的问题,您需要一种方法来测试文件是否存在。你应该可以使用exists(/path/to/file)函数

找到这个例子

EXTRAS = handlers tests docs
for(dir, EXTRAS) {
    exists($$dir) {
        SUBDIRS += $$dir
    }
}

来自:http://qt-project.org/doc/qt-4.8/qmake-project-files.html

【讨论】:

    猜你喜欢
    • 2013-07-28
    • 2014-04-12
    • 1970-01-01
    • 1970-01-01
    • 2014-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多