QT_ANDROID_BUILD_DIR

目标的 Android 构建目录的只读路径。

该属性自 Qt 6.12 起引入。

注意: 仅当目标平台为 Android 时,才使用此 属性。

包含用于将目标打包为 Android APK 或 AAB 的android-build 目录的路径。确切路径取决于是否设置了QT_USE_TARGET_ANDROID_BUILD_DIR:当TRUE 时,路径为<binary-dir>/android-build-<target> ;否则为<binary-dir>/android-build 。

该属性在调用qt_add_executable()时被设置,且无需等待目标对象的清理过程即可立即使用。

在自定义命令中引用构建目录时,此属性非常有用:

qt_add_executable(MyApp main.cpp)

get_target_property(android_build_dir MyApp QT_ANDROID_BUILD_DIR)
add_custom_command(POST_BUILD TARGET MyApp
    WORKING_DIRECTORY "${android_build_dir}"
    COMMAND cmd /c "${android_build_dir}/postbuild.cmd"
)

项目不应手动设置此属性。

另请参阅 QT_ANDROID_DEPLOYMENT_SETTINGS_FILE和QT_USE_TARGET_ANDROID_BUILD_DIR。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.