【问题标题】:QMake: Get full path of output executableQMake:获取输出可执行文件的完整路径
【发布时间】:2016-09-18 00:18:21
【问题描述】:

在我的 QMake .pro 文件中,我想运行 install_name_tool 来替换一些库路径。为此,我需要确定输出可执行文件的路径。特别是在 macx 上,可执行文件的路径如下所示

<build_directory>/<configuration_name>/<target_name>.app/Contents/MacOS/<target_name>

我发现了

message("build_directory=$${OUT_PWD}")
message("target_name=$${TARGET}")

是否有用于填充 configuration_name 的 QMake 变量?

默认情况下,它应该为发布配置返回“release”,为调试配置返回“debug”。根据我在网上看到的人们只是明确定义 $${DESTDIR}

debug { DESTDIR = debug }
release { DESTDIR = release }
debug_and_release { DESTDIR = bin }

如果未定义 message("DESTDIR=$$DESTDIR") 则返回 DESTDIR 的空值。

【问题讨论】:

    标签: qt qmake


    【解决方案1】:

    这行得通:

    CONFIG(debug, debug|release) {
        DEBUG_OR_RELEASE = debug
    }  else {
        DEBUG_OR_RELEASE = release
    }
    

    那么完整的输出路径是:

    $${OUT_PWD}/$${DEBUG_OR_RELEASE}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-20
      • 2019-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-19
      • 1970-01-01
      相关资源
      最近更新 更多