Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.4.2
-
Windows 10
-
-
e7b8b7bfb (dev), 0a0f77782 (dev), fa34315a5 (6.5), 50cff47d1 (6.5), 3b234eefe (dev), 784add8a6 (6.5)
Description
Just getting into deploying packages with shared libraries so I figured I'd give qt_generate_deploy_app_script() a go:
qt_generate_deploy_app_script(
TARGET "MyExecuteable"
FILENAME_VARIABLE qt_runtime_deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${qt_runtime_deploy_script})
This is a list of the executable target's list of links:
PRIVATE STAR::Base Qt6::Core Qx::Core Qx::Io
and this is a list of STAR:Base's (which is a lib that is also part of the project) own links:
PRIVATE Qx::Core Qx::Io PUBLIC Qt6::Core
Qx is external to the project, but brought in via add_subdirectory() (FetchContent) so from CMake's perspective it is part of the build tree. It has no other dependencies in this case other than Qt6:Core.
The documentation for qt_deploy_runtime_dependencies() states:
It will install non-system libraries (both Qt and those provided by the project), plus an appropriate set of Qt plugins.
which I interpret as meaning it will install all runtime dependencies contributed by all of the targets that the provided target is linked to (Qt or not), except for system libraries.
Therefore, I expect the bin directory on Windows at the end of installation to contain the following:
MyExecutable.exe STARBase.dll QxCore.dll QxIo.dll Qt6Core.dll qt.conf
however, I instead find the following:
MyExecutable.exe Qt6Core.dll qt.conf vc_redist.x64.exe
There are also a number of Visual C++ redistributable related DLLs installed if I build in a Debug configuration:
concrt140d.dll msvcp140_1d.dll msvcp140_2d.dll msvcp140d.dll msvcp140d_atomic_wait.dll msbcp140d_codecvt_ids.dll
though perhaps this isn't an issue since mainly you run deployment for Release builds.
Anyway, the first issue:
The libraries in the project that MyExecuteable links to are not installed.
I wonder if this is because the generated script is only checking IMPORTED targets, similar to how CMake's own install(TARGETS ... RUNTIME_DEPENDENCIES) purposely blacklists targets that are part of the current build tree. This would be unfortunate given I'm explicitly trying to avoid that behavior as I'm not installing the libs here directly since they are only built as dependencies, and so I want them to be installed as such (i.e. only their runtime binaries) without having to explicitly install them.
Or maybe it's just a bug.
The second issue:
Please add a switch argument to qt_generate_deploy_app_script() that makes the Visual C/C++ Redistributable installer opt-in (or at least one that let's you opt out) as I don't want that distributed as part of my core package. This is also nearly equivalent to "installing a system library" which contradicts the documentation.
EDIT:
Attached MRE. Build and install. In any configuration, test_lib.dll is not copied to CMAKE_INSTALL_PREFIX/bin, and in Release configuration vc_redist.x64.exe is installed there without an option to disable it.
Attachments
For Gerrit Dashboard: QTBUG-111741 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
465399,4 | CMake: Add NO_COMPILER_RUNTIME to deploy script macros | dev | qt/qtbase | Status: MERGED | +2 | 0 |
465569,2 | CMake: Add NO_COMPILER_RUNTIME to qt_generate_deploy_qml_app_script | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
466518,1 | CMake: Add NO_COMPILER_RUNTIME to deploy script macros | 6.5.0 | qt/qtbase | Status: ABANDONED | +2 | 0 |
466519,2 | CMake: Add NO_COMPILER_RUNTIME to deploy script macros | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
466523,2 | CMake: Add NO_COMPILER_RUNTIME to qt_generate_deploy_qml_app_script | 6.5 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
466524,1 | CMake: Add NO_COMPILER_RUNTIME to qt_generate_deploy_qml_app_script | 6.5.0 | qt/qtdeclarative | Status: ABANDONED | +2 | 0 |
469053,3 | Doc: Clarify what's deployed by qt_deploy_runtime_dependencies | dev | qt/qtbase | Status: MERGED | +2 | 0 |
469371,2 | Doc: Clarify what's deployed by qt_deploy_runtime_dependencies | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |