Bug 459214 - A macOS-specific BUNDLE_INSTALL_DIR installs to /Application, which is rather unwanted
Summary: A macOS-specific BUNDLE_INSTALL_DIR installs to /Application, which is rather...
Status: ASSIGNED
Alias: None
Product: extra-cmake-modules
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.98.0
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: ecm-bugs-null@kde.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-16 14:07 UTC by Dawid Wróbel
Modified: 2022-09-22 14:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Wróbel 2022-09-16 14:07:51 UTC
SUMMARY
When an add_executable() binary is cmake-installed on macOS, it ends up copied directly into /Applications/KDE. This is defined by KDEInstallDirs5 and follows the original assumption from 10 years ago, when KDEInstallDirs.cmake was crafted: https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/7289a5515ef107f1d15a4743a63b298337d9a214

Not only this ignores the -DCMAKE_INSTALL_PREFIX, it goes against the paradigm of macOS apps, where additional helper tools typically  provided by add_executable() would be added *inside* the main app bundle itself — see https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle for a reference.

 In this context, a library (L) should not be installing its helper tool (T) bundle to /Application. Instead, any Application (A) which depends on library (L) should embed that library's tooling (T) bundles inside its (A's) own bundle.

What it means for the libraries is that bundles should be installed into regular /bin folder, while consuming Application's packaging tooling should copy the binaries accordingly — which, I believe, is the case for Craft.

STEPS TO REPRODUCE
1. Checkout kf5guiaddons
2. run cmake with an added -DCMAKE_INSTALL_PREFIX=/tmp/foo
3. make install

OBSERVED RESULT

(...)
-- Installing: /tmp/foo/debug/mkspecs/modules/qt_KGuiAddons.pri
-- Installing: /tmp/foo/debug/share/qlogging-categories5/kguiaddons.categories
-- Up-to-date: /Applications/KDE/kde-geo-uri-handler.app
-- Up-to-date: /Applications/KDE/kde-geo-uri-handler.app/Contents
(...)

EXPECTED RESULT
kde-geo-uri-handler.app bundle should be installed in /tmp/foo/bin/
Comment 1 Bug Janitor Service 2022-09-22 14:08:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/298