Cmake is not linking



  • Hi there,

    I have a problem regarding QT and cmake:

    In my application I'm using QML to program the view and in there I'm using .svg files as images and also import Multimedia 5.0 to play sounds.

    Therefore I've added following lines to my CmakeList.txt:
    FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Multimedia Svg)
    TARGET_LINK_LIBRARIES(target Qt5::Multimedia Qt5::Svg)
    together with Qt5 Core, Gui, Qml and so on.

    Unfortunately the multimedia and SVG packages are not linked as dependencies of the executable, as these aren't needed from the c++ backend.

    When trying to deploy the application under windows 7 with windeployqt.exe from the QT-binary path, the dependencies to these to packages are not recognized as these aren't in the application ...
    Somehow there is a crude dependency to SVG, so it is added by the tool but is not shown as a direct dependency of my file.

    When executing my application the qml component using the multimedia package is blaming about the missing library.

    Anybody any suggestions on how to force the linking of the packages ?

    The application is develeoped in and deployed to windows 7.



  • It should not be necessary to prepend with "Qt5::"
    Just use:

    find_package(Qt5Svg REQUIRED)
    find_package(Qt5Multimedia REQUIRED)
    
    ...
    qt5_use_modules(target Multimedia Svg)
    target_link_libraries(target MyOtherLibs)
    


  • Sry, but your approach isn't working also. The mulitmedia and svg packages are still not linked as dependencies into the executable.

    Other packages as core and network are linked though, but those were also already linked before ...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.