Where to put KDE Frameworks cmake stuff...

Alexander Neundorf neundorf at kde.org
Sat Apr 21 19:43:43 UTC 2012


On Saturday 21 April 2012, Alexander Neundorf wrote:
> On Saturday 21 April 2012, Stephen Kelly wrote:
...
> > What if I also have KCoreAddons installed in /opt/myotherkf5 ? How would
> > I decide which KF5-cmake-container-prefix to use? Environment variables
> > and wrapper scripts?
> 
> As always, CMAKE_PREFIX_PATH.
> If you are a user of KF5, and not part of KF5, i.e. not including
> KF5BuildSpecs.cmake, then nothing special happens.
> You'll get the set of KDE-specific install location variables, set to their
> default values.
> 
> If you do
> find_package(KF5 COMPONETS KCoreAddons KWidgets)
> 
> then first KF5-cmake will be found somewhere in some prefix, and then the
> listed components will be only searched in the same prefix, and
> additionally in a shadowed prefix, if this KF5 has been installed as
> shadowing an already existing one (intended for developers of a frameworks
> library).
> 
> If you additionally do
> include(KF5BuildSpecs)
> this makes you follow the frameworks rules.
> So, if you have set CMAKE_INSTALL_PREFIX to /opt/kf5, where your
> KCoreAddons will have been found, you'll get the same install locations as
> what is already installed in /opt/kf5. If you have set your
> CMAKE_INSTALL_PREFIX to something else, you'll get a cmake error.
> This way it is enforced that all KDE frameworks libraries are installed
> together (yes, one can still work around this by manually settings other
> install dirs in the cache).
> 
> If not doing this, you may have arbitrary versions of the libraries in
> various places on your system, where it may happen very well that cmake
> will find incompatible versions (happend at least with phonon and
> nepomuk).

Ok, the prototype is attached.

The FindKF5.cmake must be copied for now into e-c-m/find-modules/.

The tarball contains:
* KF5: this is the KF5-cmake-meta package. When installing it, you must 
specify whether this will be a SEPARATE or a SHADOWING install by setting the 
KF5_MODE variable accordingly. If it is separate, components will be searched 
only in its own install prefix. If it is SHADOWING, components will be 
searched first in its own, then it its shadowed prefix.

* Bar and Foo: these are two "KDE frameworks libraries". They search KF5 
first, and get all the KDE stuff. 

* hello: that's a demo application, which uses both Foo and Bar, using 
FindKF5.cmake. 

1. Basic usage: install KF5 somewhere, and Bar and Foo to the same prefix. 
KF5_MODE has to be set to SEPARATE.
This applies for the following cases:
* a frameworks developer who wants to build everything, no matter whether KF5 
is already installed on his system or not
* a 3rd party developer who just wants to build one of the frameworks 
libraries.

2. A frameworks developer who wants to work on just one frameworks library: 
first do as above described in 1.), then install a second KF5 somewhere else, 
but make it SHADOWING, and set KF5_SHADOWED_DIR to the prefix from 1.).
Set CMAKE_PREFIX_PATH so that the SHADOWING one will be found first.
Build and install Bar this way into the SHADOWING KF5.
Build hello. It will use Bar from the SHADOWING and Foo from the SEPARATE 
install.
This applies in the case of a frameworks developer who wants to use the libs 
from his distro, and work on just a subset of the frameworks libraries, i.e. 
those should shadow the distro KF5 libs.

Are there other cases ?

Please have a look at it and play around with it.

Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kf5proto.tar.gz
Type: application/x-compressed-tar
Size: 13370 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20120421/6a4dbdc2/attachment.tar.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindKF5.cmake
Type: application/octet-stream
Size: 1749 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20120421/6a4dbdc2/attachment.obj>


More information about the Kde-frameworks-devel mailing list