summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc
blob: 6faf1a3cdfc055cbb39443ef4aeecf055bae67ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
\badcode
cmake_minimum_required(VERSION 3.16...3.22)
project(MyThings)

find_package(Qt6 REQUIRED COMPONENTS Core)
qt_standard_project_setup()

qt_add_executable(MyApp main.cpp)

# The following script must only be executed at install time
set(deploy_script "${CMAKE_CURRENT_BINARY_DIR}/deploy_MyApp.cmake")

file(GENERATE OUTPUT ${deploy_script} CONTENTS "
include(\"${QT_DEPLOY_SUPPORT}\")
qt_deploy_runtime_dependencies(
    EXECUTABLE \"\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>\"
)
")

install(TARGETS MyApp)              # Install the target
install(SCRIPT ${deploy_script})    # Add its runtime dependencies
\endcode