qt_generate_deploy_qml_app_script generates script with empty include()
-
Here's a CMakeLists.txt that is attempting to use the CMake macro
qt_generate_deploy_qml_app_script
. I'm following the blog here [1]. Everything seems fine until the install stage, where it seems the deploy script is missing some environment variables being set. The main one I've discovered so far is ${QT_DEPLOY_SUPPORT}. This seems to be something the Core library should set at some point, but it's empty in my case resulting in a deploy script that errors out.find_package(Qt6 COMPONENTS Core Gui Qml REQUIRED) qt_standard_project_setup() set(QML_FILES qml/Intro.qml qml/RootWindow.qml ) set(CPP_FILES QWarClientApp.cpp ) qt_add_executable(QWarClient main.cpp ) qt_add_qml_module(QWarClient VERSION 1.0 URI "QWarClient" QML_FILES ${QML_FILES} SOURCES ${CPP_FILES} ) target_link_libraries(QWarClient PRIVATE Qt6::Core Qt6::Gui Qt6::Qml ) install(TARGETS QWarClient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) qt_generate_deploy_qml_app_script( TARGET QWarClient FILENAME_VARIABLE deploy_script NO_UNSUPPORTED_PLATFORM_ERROR ) message("deploy script name: ${deploy_script}") message("qt_deploy_support: ${QT_DEPLOY_SUPPORT}") install(SCRIPT ${deploy_script})
the generated deploy script ends up looking like this:
include() _qt_internal_show_skip_runtime_deploy_message("static Qt libs") _qt_internal_show_skip_qml_runtime_deploy_message()
Is there something I'm missing here?
-
Here's a CMakeLists.txt that is attempting to use the CMake macro
qt_generate_deploy_qml_app_script
. I'm following the blog here [1]. Everything seems fine until the install stage, where it seems the deploy script is missing some environment variables being set. The main one I've discovered so far is ${QT_DEPLOY_SUPPORT}. This seems to be something the Core library should set at some point, but it's empty in my case resulting in a deploy script that errors out.find_package(Qt6 COMPONENTS Core Gui Qml REQUIRED) qt_standard_project_setup() set(QML_FILES qml/Intro.qml qml/RootWindow.qml ) set(CPP_FILES QWarClientApp.cpp ) qt_add_executable(QWarClient main.cpp ) qt_add_qml_module(QWarClient VERSION 1.0 URI "QWarClient" QML_FILES ${QML_FILES} SOURCES ${CPP_FILES} ) target_link_libraries(QWarClient PRIVATE Qt6::Core Qt6::Gui Qt6::Qml ) install(TARGETS QWarClient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) qt_generate_deploy_qml_app_script( TARGET QWarClient FILENAME_VARIABLE deploy_script NO_UNSUPPORTED_PLATFORM_ERROR ) message("deploy script name: ${deploy_script}") message("qt_deploy_support: ${QT_DEPLOY_SUPPORT}") install(SCRIPT ${deploy_script})
the generated deploy script ends up looking like this:
include() _qt_internal_show_skip_runtime_deploy_message("static Qt libs") _qt_internal_show_skip_qml_runtime_deploy_message()
Is there something I'm missing here?
@rhvonlehe If I remove the
NO_UNSUPPORTED_PLATFORM_ERROR
option fromqt_generate_deploy_qml_app_script
then I get a CMake configuration error like this:CMake Error at C:/.conan/ac5814/1/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3088 (message): Support for installing runtime dependencies is not implemented for this target platform (Windows, static Qt libs). Call Stack (most recent call first): C:/.conan/ac5814/1/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3104 (qt6_generate_deploy_qml_app_script) client/CMakeLists.txt:37 (qt_generate_deploy_qml_app_script)
I'm confused about why it thinks I'm trying to use static Qt libs.
Below is my conanfile.py
from conans import ConanFile from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake class QWar(ConanFile): name = "QWar" version = "0.1" settings = "os", "compiler", "build_type", "arch" requires = "boost/1.77.0", "qt/6.4.2" generators = "CMakeToolchain", "CMakeDeps" def configure(self): # requiring qt doesn't get all modules, some have to be explicitly added as # shown here self.options["qt"].qtdeclarative = True self.options["qt"].shared = True def build(self): cmake = CMake(self) cmake.configure() cmake.build()
-
@rhvonlehe If I remove the
NO_UNSUPPORTED_PLATFORM_ERROR
option fromqt_generate_deploy_qml_app_script
then I get a CMake configuration error like this:CMake Error at C:/.conan/ac5814/1/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3088 (message): Support for installing runtime dependencies is not implemented for this target platform (Windows, static Qt libs). Call Stack (most recent call first): C:/.conan/ac5814/1/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3104 (qt6_generate_deploy_qml_app_script) client/CMakeLists.txt:37 (qt_generate_deploy_qml_app_script)
I'm confused about why it thinks I'm trying to use static Qt libs.
Below is my conanfile.py
from conans import ConanFile from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake class QWar(ConanFile): name = "QWar" version = "0.1" settings = "os", "compiler", "build_type", "arch" requires = "boost/1.77.0", "qt/6.4.2" generators = "CMakeToolchain", "CMakeDeps" def configure(self): # requiring qt doesn't get all modules, some have to be explicitly added as # shown here self.options["qt"].qtdeclarative = True self.options["qt"].shared = True def build(self): cmake = CMake(self) cmake.configure() cmake.build()
@rhvonlehe Some more context:
There's an important variable that gets checked in Qt6QmlMacros.cmake called QT6_IS_SHARED_LIBS_BUILD. If this CMake variable is not set, it will error out as shown in my previous posts because it assumes the Qt6 build created static libraries. The only place I see QT6_IS_SHARED_LIBS_BUILD being set to true is in Qt6CoreConfigExtras.cmake. However, when I run
cmake --trace
I don't ever see that module being used.The only path to getting that variable set is to have these cmake modules included in this order:
QtSetup.cmake --> QtBuild.cmake ->> QtModuleHelpers.cmake --> Qt6CoreConfigExtras.cmakeI don't know when or how those are supposed to get included and by whom.
Does anyone have any knowledge of this?
EDIT: I can see now that QtSetup and QtBuild are CMake modules that are only supposed to be used for the actual building of Qt6. So my question now becomes, why is this variable
QT6_IS_SHARED_LIBS_BUILD
being relied on when invokingqt_generate_deploy_qml_app_script
from a user program when a user program's CMake will never invoke the modules that set that variable? -
@rhvonlehe Some more context:
There's an important variable that gets checked in Qt6QmlMacros.cmake called QT6_IS_SHARED_LIBS_BUILD. If this CMake variable is not set, it will error out as shown in my previous posts because it assumes the Qt6 build created static libraries. The only place I see QT6_IS_SHARED_LIBS_BUILD being set to true is in Qt6CoreConfigExtras.cmake. However, when I run
cmake --trace
I don't ever see that module being used.The only path to getting that variable set is to have these cmake modules included in this order:
QtSetup.cmake --> QtBuild.cmake ->> QtModuleHelpers.cmake --> Qt6CoreConfigExtras.cmakeI don't know when or how those are supposed to get included and by whom.
Does anyone have any knowledge of this?
EDIT: I can see now that QtSetup and QtBuild are CMake modules that are only supposed to be used for the actual building of Qt6. So my question now becomes, why is this variable
QT6_IS_SHARED_LIBS_BUILD
being relied on when invokingqt_generate_deploy_qml_app_script
from a user program when a user program's CMake will never invoke the modules that set that variable?@rhvonlehe
Qt6CoreConfigExtras.cmake
is supposed to be included by theQt6Core
CMake package.
Thefind_package
call at the top of yourCMakeLists.txt
file should take care of that.Please configure your project with
--trace-expand --trace-redirect=cmake.trace
, and make that trace file available. Then we can have a look whyQt6CoreConfigExtras.cmake
is not loaded for you. -
@rhvonlehe
Qt6CoreConfigExtras.cmake
is supposed to be included by theQt6Core
CMake package.
Thefind_package
call at the top of yourCMakeLists.txt
file should take care of that.Please configure your project with
--trace-expand --trace-redirect=cmake.trace
, and make that trace file available. Then we can have a look whyQt6CoreConfigExtras.cmake
is not loaded for you.For reference, here's the bug report Rich created for this issue: https://bugreports.qt.io/browse/QTBUG-113769