이 페이지에서

QT_DEPLOY_BIN_DIR

일부 대상 플랫폼에서 런타임 바이너리를 배포하기 위한 접두사 상대 하위 디렉터리.

이 변수는 QT_DEPLOY_SUPPORT로 지정된 스크립트에 의해 정의됩니다. 이 변수는 설치 과정 중 배포 단계나 빌드 후 규칙의 일부로만 사용되어야 합니다.

참고: 이 변수는 저수준 배포 API 변수이며, qt_generate_deploy_app_script와 같은 상위 수준 API 명령어로 처리되지 않는 고급 사용 사례에서만 사용해야 합니다.

이 변수는 Qt 6.3에서 도입되었습니다.

프로젝트에서는 다음 유형의 바이너리를 배포할 특정 디렉터리를 하드코딩하지 않도록 배포 스크립트에서 ` QT_DEPLOY_BIN_DIR `를 사용해야 합니다:

  • 모든 플랫폼의 실행 파일.
  • Windows용 DLL.

QT_DEPLOY_BIN_DIR 기본값은 CMake의 GNUInstallDirs 모듈에서 제공하는 ${CMAKE_INSTALL_BINDIR} 의 값(보통 bin)입니다. QT_DEPLOY_BIN_DIR 의 값을 변경하려면, 프로젝트에서 Core 패키지가 발견되기 전에 CMAKE_INSTALL_BINDIR 를 설정해야 합니다.

QT_DEPLOY_BIN_DIR 경로는 QT_DEPLOY_PREFIX를 기준으로 합니다.

이 변수는 macOS 앱 번들로 배포할 때는 의미가 없으므로, 해당 시나리오에서는 사용해서는 안 됩니다.

예시

cmake_minimum_required(VERSION 3.16...3.22)
project(MyThings)

find_package(Qt6 REQUIRED COMPONENTS Core)
qt_standard_project_setup()

# Keep the QT_DEPLOY_* references below for the generated script to expand,
# see \l {QTP0008}.
qt_policy(SET QTP0008 NEW)

qt_add_executable(MyApp main.cpp)

set_target_properties(MyApp PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

# App bundles on macOS have an .app suffix
if(APPLE)
    set(executable_path "$<TARGET_FILE_NAME:MyApp>.app")
else()
    set(executable_path "\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>")
endif()

# Helper app, not necessarily built as part of this project.
qt_add_executable(HelperApp helper.cpp)
set(helper_app_path "\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:HelperApp>")

# Generate a deployment script to be executed at install time
qt_generate_deploy_script(
    TARGET MyApp
    OUTPUT_SCRIPT deploy_script
    CONTENT "
qt_deploy_runtime_dependencies(
    EXECUTABLE \"${executable_path}\"
    ADDITIONAL_EXECUTABLES \"${helper_app_path}\"
    GENERATE_QT_CONF
    VERBOSE
)")

# Omitting RUNTIME DESTINATION will install a non-bundle target to CMAKE_INSTALL_BINDIR,
# which coincides with the default value of QT_DEPLOY_BIN_DIR used above, './bin'.
# Installing macOS bundles always requires an explicit BUNDLE DESTINATION option.
install(TARGETS MyApp HelperApp    # Install to CMAKE_INSTALL_PREFIX/bin/MyApp.exe
                                   #                           and ./binHelperApp.exe
        BUNDLE  DESTINATION .      # Install to CMAKE_INSTALL_PREFIX/MyApp.app/Contents/MacOS/MyApp
)
install(SCRIPT ${deploy_script})    # Add its runtime dependencies

참조: QT_DEPLOY_SUPPORT, QT_DEPLOY_PREFIX, QT_DEPLOY_LIBEXEC_DIR, QT_DEPLOY_LIB_DIR, QT_DEPLOY_PLUGINS_DIR, QT_DEPLOY_QML_DIR 및 QT_DEPLOY_TRANSLATIONS_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.