Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-105583

CMake deployment API generates faulty script if CMAKE_INSTALL_BINDIR is set to "." or ""

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.5.0 Beta1
    • 6.3.1
    • Build System: CMake
    • None
    • Windows
    • 2f7a78cd7b (qt/qtbase/dev) 2f7a78cd7b (qt/tqtc-qtbase/dev) 35a47549d2 (qt/qtbase/6.3) 35a47549d2 (qt/tqtc-qtbase/6.3)

    Description

      Modify the wiggly example's CMakeLists.txt to look like this:

      cmake_minimum_required(VERSION 3.16)
      project(wiggly LANGUAGES CXX)
      
      set(CMAKE_INSTALL_BINDIR ".")
      find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
      qt_standard_project_setup()
      
      qt_add_executable(wiggly
          dialog.cpp dialog.h
          main.cpp
          wigglywidget.cpp wigglywidget.h
      )
      
      set_target_properties(wiggly PROPERTIES
          WIN32_EXECUTABLE TRUE
          MACOSX_BUNDLE TRUE
      )
      
      target_link_libraries(wiggly PUBLIC
          Qt::Widgets
      )
      
      install(TARGETS wiggly
          RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
          BUNDLE DESTINATION .
      )
      
      qt_generate_deploy_app_script(
          TARGET wiggly
          FILENAME_VARIABLE deploy_script
      )
      install(SCRIPT ${deploy_script})
      

      This will create a qt.conf next to wiggly.exe with the following content:

      [Paths]
      Prefix = ..
      Binaries = .
      

      The prefix should be "."

      Changing the CMAKE_INSTALL_BINDIR variable to the empty string leads to an error on installation:

      ...
      -- Running Qt deploy tool for /wiggly.exe in working directory 'D:/TEMP/wiggly'
      'D:/dev/qt/dev-x86_64/qtbase/bin/windeployqt.exe' '/wiggly.exe' '--dir' '.' '--libdir' '--plugindir' 'plugins' '--force'
      "\wiggly.exe" does not exist.
      

      Attachments

        For Gerrit Dashboard: QTBUG-105583
        # Subject Branch Project Status CR V

        Activity

          People

            jbornema Joerg Bornemann
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes