Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qt_generate_deploy_qml_app_script generates script with empty include()
Forum Update on Monday, May 27th 2025

qt_generate_deploy_qml_app_script generates script with empty include()

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 577 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rhvonlehe
    wrote on 5 May 2023, 02:55 last edited by rhvonlehe 5 May 2023, 02:55
    #1

    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?

    [1] https://www.qt.io/blog/cmake-deployment-api

    R 1 Reply Last reply 10 May 2023, 03:31
    0
    • R rhvonlehe
      5 May 2023, 02:55

      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?

      [1] https://www.qt.io/blog/cmake-deployment-api

      R Offline
      R Offline
      rhvonlehe
      wrote on 10 May 2023, 03:31 last edited by rhvonlehe 5 Oct 2023, 03:32
      #2

      @rhvonlehe If I remove the NO_UNSUPPORTED_PLATFORM_ERROR option from qt_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()
      
      R 1 Reply Last reply 24 May 2023, 02:08
      0
      • R rhvonlehe
        10 May 2023, 03:31

        @rhvonlehe If I remove the NO_UNSUPPORTED_PLATFORM_ERROR option from qt_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()
        
        R Offline
        R Offline
        rhvonlehe
        wrote on 24 May 2023, 02:08 last edited by rhvonlehe
        #3

        @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.cmake

        I 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?

        joborJ 1 Reply Last reply 30 May 2023, 08:39
        0
        • R rhvonlehe
          24 May 2023, 02:08

          @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.cmake

          I 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?

          joborJ Offline
          joborJ Offline
          jobor
          wrote on 30 May 2023, 08:39 last edited by
          #4

          @rhvonlehe Qt6CoreConfigExtras.cmake is supposed to be included by the Qt6Core CMake package.
          The find_package call at the top of your CMakeLists.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 why Qt6CoreConfigExtras.cmake is not loaded for you.

          joborJ 1 Reply Last reply 2 Jun 2023, 06:38
          1
          • joborJ jobor
            30 May 2023, 08:39

            @rhvonlehe Qt6CoreConfigExtras.cmake is supposed to be included by the Qt6Core CMake package.
            The find_package call at the top of your CMakeLists.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 why Qt6CoreConfigExtras.cmake is not loaded for you.

            joborJ Offline
            joborJ Offline
            jobor
            wrote on 2 Jun 2023, 06:38 last edited by
            #5

            For reference, here's the bug report Rich created for this issue: https://bugreports.qt.io/browse/QTBUG-113769

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved