Bug 481954

Summary: KWidgetsAddons fails to build at configure step with -DBUILD_SHARED_LIBS=OFF
Product: [Frameworks and Libraries] frameworks-kwidgetsaddons Reporter: equeim
Component: generalAssignee: Christoph Feck <cfeck>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs-null, nicolas.fella
Priority: NOR Keywords: qt6
Version First Reported In: 6.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Possible fix for KWidgetsAddons

Description equeim 2024-02-28 19:32:27 UTC
SUMMARY
When passing -DBUILD_SHARED_LIBS=OFF argument to CMake at configuration step, CMake fails with following error:

CMake Error: install(EXPORT "KF6WidgetsAddonsTargets" ...) includes target "KF6WidgetsAddons" which requires target "KF6WidgetsAddons_resources_1" that is not in any export set.

STEPS TO REPRODUCE
1. Try to build KWidgetsAddons with -DBUILD_SHARED_LIBS=OFF

OBSERVED RESULT
CMake configuration fails.

EXPECTED RESULT
CMake configuration succeeds.

SOFTWARE/OS VERSIONS
Linux: Fedora 39
KDE Frameworks Version: 6.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
It looks like the issue is triggered by qt_add_resources call: https://invent.kde.org/frameworks/kwidgetsaddons/-/blob/v6.0.0/src/CMakeLists.txt?ref_type=tags#L324

So it could be Qt bug.
Comment 1 equeim 2024-07-28 19:33:25 UTC
Created attachment 172075 [details]
Possible fix for KWidgetsAddons

I think I found a way to make it work.
The problem is that when building static library qt_add_resources adds separate targets for resources that need to be installed.
Unfortunately it needs to be done for every use of qt_add_resources, in all libraries.
I attached a patch that seems to fix the issue for KWidgetsAddons.