Bug 342717

Summary: KDEInstallDirs: unset calls break mixed GNUInstallDirs+KDEInstallDirs projects (e.g. Calamares)
Product: [Frameworks and Libraries] extra-cmake-modules Reporter: Kevin Kofler <kevin.kofler>
Component: generalAssignee: Alex Merry <alex.merry>
Status: RESOLVED FIXED    
Severity: major CC: demm, ecm-bugs-null, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 1.6.1

Description Kevin Kofler 2015-01-11 03:40:53 UTC
In ECM 1.6.0, KDEInstallDirs now unsets the "old-style" variables after setting the KDE_* ones based on them. Unfortunately, this breaks projects such as Calamares which build only parts using ECM+KF5 and other parts using plain GNUInstallDirs and Qt 5 only.

Reproducible: Always

Steps to Reproduce:
1. Try to build Calamares in Fedora Rawhide with the default defines from our %cmake_kf5 macro.

Actual Results:  
The build fails.

Expected Results:  
The build succeeds.

This patch: http://pkgs.fedoraproject.org/cgit/extra-cmake-modules.git/plain/extra-cmake-modules-1.6.0-KDEInstallDirs-no-unset.patch works for us in Fedora.
Comment 1 Kevin Kofler 2015-01-11 03:56:24 UTC
Proposed fix: https://git.reviewboard.kde.org/r/121978/
Comment 2 Alex Merry 2015-01-11 11:14:20 UTC
I hadn't considered that use case. You're right - we shouldn't be messing with the cache variables.

As noted on your RR, a slightly more involved fix is needed: https://git.reviewboard.kde.org/r/121982/
Comment 3 Kevin Kofler 2015-01-11 12:22:57 UTC
Makes sense, I had only considered the distro package use case, where we run cmake once with a cache that's always empty and where the only effect of CACHE is that the variable can be set on the command line.

I'm testing your version of the patch now.
Comment 4 Alex Merry 2015-01-11 16:22:41 UTC
Git commit 4462e9ddedb78c31a6f1089d073b1bfde6ce60ce by Alex Merry.
Committed on 11/01/2015 at 10:57.
Pushed by alexmerry into branch 'master'.

Do not unset cache variables in KDEInstallDirs.

Cache variables such as CMAKE_INSTALL_BINDIR may be used by other
modules included from parallel parts of the tree, so we should not touch
them. We still override them in the runtime environment, but this will
not interfere with parallel subtrees of the project.

As part of this, the order of precedence of variables specified on the
command line is changed, so that KDE_INSTALL_* is considered first
(although it is still considered "undefined" in the documentation). This
means that if you only specify CMAKE_INSTALL_BINDIR, that will be used
by both KDEInstallDirs and GNUInstallDirs, but if you specify both that
and KDE_INSTALL_BINDIR, KDEInstallDirs will use KDE_INSTALL_BINDIR
instead.  This is probably not too useful, but seems more useful than
any other arrangement.
REVIEW: 121982

M  +20   -18   kde-modules/KDEInstallDirs.cmake

http://commits.kde.org/extra-cmake-modules/4462e9ddedb78c31a6f1089d073b1bfde6ce60ce