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. Linking external .dll with CMake
Forum Updated to NodeBB v4.3 + New Features

Linking external .dll with CMake

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 76 Views 1 Watching
  • 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.
  • B Offline
    B Offline
    BrianL
    wrote last edited by
    #1

    Hello, I have recently trying to migrate my project from Qt5 qmake to Qt6 cmake.
    I would like to link external .dll files to be used for the project. In particular LibVLC which has libvlc.dll and libvlccore.dll.

    In qmake all I had to do was this:

    INCLUDEPATH += "../LibVLC/include"
    LIBS += -L"../LibVLC" -lvlc -lvlccore
    

    But I'm unsure what to actually put in cmake to use the dll files since I'm very new to it.
    I was at least able to link the source code directory with:

    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/External/LibVLC/include)
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      You don't link against dlls but against lib files.

      For cmake it's target_link_libraries.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You don't link against dlls but against lib files.

        For cmake it's target_link_libraries.

        B Offline
        B Offline
        BrianL
        wrote last edited by
        #3

        @SGaist Thanks for the reply, they didn't provide the .lib files in the source code, so I had to generate them myself. I was able to find https://wiki.videolan.org/GenerateLibFromDll explaining how to do it and got the application to run now, thanks!

        1 Reply Last reply
        0
        • B BrianL has marked this topic as solved

        • Login

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