summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2022-09-02 12:53:40 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2022-09-12 07:36:12 +0200
commit542f837fa2bc5d6009e966c7fa9d7909cef22d2d (patch)
tree33f993177e967ddb0900fa45c8ce3233885c9725
parentc288733541b7842f0aa91dba378a00e6c158fa6e (diff)
CMake: Clarify qt_deploy_runtime_dependencies' EXECUTABLE argument
In a subsequent commit we will add Linux support for qt_deploy_runtime_dependencies based on file(GET_RUNTIME_DEPENDENCIES). The file(GRD) command expects that we pass the not-yet-installed executable to it, because the command reads the RUNPATH/RPATH from the executable and resolves libraries against these paths. This resolution is likely going to fail if file(GRD) is run on an installed executable, because the RPATH was modified to be relocatable in the installation phase. This patch adds a recommendation to use the build directory's executable for qt_deploy_runtime_dependencies on non-macOS platforms. Also, the Windows code path of qt_deploy_runtime_dependencies is adjusted to support both, the .exe in the build dir and the .exe in the installation prefix. For consistency, qt_generate_deploy_app_script calls qt_deploy_runtime_dependencies with EXECUTABLE pointing to the build directory's executable. [ChangeLog][CMake] On non-macOS platforms, qt_deploy_runtime_dependencies' EXECUTABLE argument now expects the executable in the build directory instead of the installation directory. Change-Id: Id76b52cc5a0f285586679d7ae600a8c7996429c1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--src/corelib/Qt6CoreDeploySupport.cmake2
-rw-r--r--src/corelib/Qt6CoreMacros.cmake2
-rw-r--r--src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc9
3 files changed, 6 insertions, 7 deletions
diff --git a/src/corelib/Qt6CoreDeploySupport.cmake b/src/corelib/Qt6CoreDeploySupport.cmake
index 6db33d2609..24ddc47bcb 100644
--- a/src/corelib/Qt6CoreDeploySupport.cmake
+++ b/src/corelib/Qt6CoreDeploySupport.cmake
@@ -173,7 +173,7 @@ function(qt6_deploy_runtime_dependencies)
set(arg_EXECUTABLE "${CMAKE_MATCH_1}")
endif()
elseif(arg_GENERATE_QT_CONF)
- get_filename_component(exe_dir "${arg_EXECUTABLE}" DIRECTORY)
+ set(exe_dir "${QT_DEPLOY_BIN_DIR}")
if(exe_dir STREQUAL "" OR exe_dir STREQUAL ".")
set(exe_dir ".")
set(prefix ".")
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 3d7b911827..aefcc34838 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -2647,7 +2647,7 @@ qt6_deploy_runtime_dependencies(
qt6_generate_deploy_script(${generate_args}
CONTENT "
qt6_deploy_runtime_dependencies(
- EXECUTABLE \${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:${arg_TARGET}>
+ EXECUTABLE $<TARGET_FILE:${arg_TARGET}>
GENERATE_QT_CONF
)")
diff --git a/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc b/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc
index 6f950b4020..f199e62594 100644
--- a/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc
+++ b/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc
@@ -58,11 +58,10 @@ see \l{qt_deploy_qml_imports()} for that.
The \c{EXECUTABLE} option must be provided.
-The \c{executable} argument should be a path to the executable file, relative to
-the base install location. For example, \c{bin/MyApp.exe}, or more dynamically
-\c{\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>}.
-Specifying raw target names not wrapped in a generator epxression like
-\c{<TARGET_FILE_NAME:>} is not supported.
+The \c{executable} argument should be the path to the executable file in the
+build directory. For example, \c{${CMAKE_CURRENT_BINARY_DIR}/MyApp.exe}, or more
+dynamically \c{$<TARGET_FILE:MyApp>}. Specifying raw target names not wrapped in
+a generator expression like \c{<TARGET_FILE:>} is not supported.
For macOS app bundles, the \c{executable} argument should be a path to the
bundle directory, relative to the base install location.