Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Loading dlls using qtwindowdeploy
Forum Updated to NodeBB v4.3 + New Features

Loading dlls using qtwindowdeploy

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
3 Posts 2 Posters 360 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.
  • C Offline
    C Offline
    CuriousPan
    wrote on last edited by CuriousPan
    #1

    Hello everyone!
    I have a project and I need to prepare a CMakeLists.txt file for it.
    I also have tests which I need to get an executables for after building the project.

    Tests are located in a separate backEndTest folder with their own CMakeLists.txt file.
    In order to achieve that I decided to use qtwindeploy tool for that. However, when I compile everything and try to run backEndText.exe file I have errors related to missing dlls.

    That's what my main CMakeLists.txt file looks like:

    add_subdirectory(backEndTest)
    
    find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test)
    find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test)
    
    set(QtBinDir "C:/Qt/6.2.3/mingw_64/bin")
    
    set(winDeploy "${QtBinDir}/windeployqt.exe")
    
    set(backEndTest ${CMAKE_BINARY_DIR}/backEndTest/backEndTest.exe)
    
    set(testBackEnd TRUE)
    
    if (testBackEnd)
        execute_process(COMMAND ${winDeploy} ${backEndTest} --compiler-runtime )
    endif()
    

    Do you have any idea why dlls are not getting linked?

    1 Reply Last reply
    0
    • kkoehneK Offline
      kkoehneK Offline
      kkoehne
      Moderators
      wrote on last edited by
      #2

      execute_process() is a command that will be immediately executed when CMake is run. But at this time backEndTest.exe has not been built yet.

      What you should do is schedule the run of windeployqt after backEndTest.exe has been generated, e.g. with a add_custom_command().

      If you are using Qt 6.3, you can also consider using qt_generate_deploy_app_script()

      Director R&D, The Qt Company

      C 1 Reply Last reply
      0
      • kkoehneK kkoehne

        execute_process() is a command that will be immediately executed when CMake is run. But at this time backEndTest.exe has not been built yet.

        What you should do is schedule the run of windeployqt after backEndTest.exe has been generated, e.g. with a add_custom_command().

        If you are using Qt 6.3, you can also consider using qt_generate_deploy_app_script()

        C Offline
        C Offline
        CuriousPan
        wrote on last edited by
        #3

        @kkoehne this seems to be as a quite nice solution. Could you guide me on how to add this custom command to run after backEndTest.exe is created, please?

        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