Skip to content

[Qt] Make target linkage against Qt5 sane #9442

@Neumann-A

Description

@Neumann-A

Unfortunally Qt5 targets do not link against system libs at all. This is why the current vcpkg_cmake_wrapper is required.

For example to make paraview build with static plugins the following is required in the wrapper:

    elseif(UNIX AND NOT APPLE)
      add_qt_library(Qt5::Core            
            Qt5GraphicsSupport
            Qt5ClipboardSupport
            Qt5LinuxAccessibilitySupport
            Qt5AccessibilitySupport
            Qt5ServiceSupport
            Qt5FbSupport
            Qt5EglSupport
            Qt5InputSupport
            Qt5DeviceDiscoverySupport
            Qt5EdidSupport
            Qt5KmsSupport
            Qt5GlxSupport
            Qt5EglFSDeviceIntegration
            Qt5EglFsKmsSupport
            Qt5XcbQpa
            EGL
            fontconfig expat
            Qt5Gui
            Qt5DBus
            Qt5Core)
       #find_package(X11 REQUIRED) 
       set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_LINK_LIBRARIES
            xcb-glx X11-xcb xcb-xinput xcb-icccm xcb-image xcb-shm xcb-keysyms xcb-randr xcb-render-util 
            xcb-render xcb-shape xcb-sync xcb-xfixes xcb-xinerama xcb-xkb xcb Xrender Xext X11 
            m SM ICE mtdev input xkbcommon-x11 xkbcommon dl GL gbm udev
            OpenSSL::SSL OpenSSL::Crypto Freetype::Freetype
            dbus-1 drm gthread-2.0 glib-2.0 gtk-3 gdk-3 pangocairo-1.0 pango-1.0 atk-1.0 cairo-gobject cairo gdk_pixbuf-2.0 gio-2.0 gobject-2.0 glib-2.0 Xext X11
            )

Simply adding all required system libraries to core seems wrong and also incomplete.
As such a better way to link all the required libraries is required.
Qt luckily creates a PRL file along the library. As such the wrapper should identify all imported Qt5 targets after the find_package call, extract the library location and parse the corresponding *.prl file of that library to acquire the required libraries necessary for linkage and add those to the interface_link_libraries property of the current analyzed target. On stupid think Qt does is that plugins does not even link again their required Qt targets which makes adding those also required.

Metadata

Metadata

Assignees

Labels

category:vcpkg-featureThe issue is a new capability of the tool that doesn’t already exist and we haven’t committeddepends:upstream-changesWaiting on a change to the upstream project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions