summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc')
-rw-r--r--src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc b/src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc
index 6faf1a3cdf..6d026d6301 100644
--- a/src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc
+++ b/src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc
@@ -7,16 +7,40 @@ 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")
+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>")
-file(GENERATE OUTPUT ${deploy_script} CONTENTS "
-include(\"${QT_DEPLOY_SUPPORT}\")
+# 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 \"\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>\"
-)
-")
+ EXECUTABLE \"${executable_path}\"
+ ADDITIONAL_EXECUTABLES \"${helper_app_path}\"
+ GENERATE_QT_CONF
+ VERBOSE
+)")
-install(TARGETS MyApp) # Install the target
+# 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
\endcode