frameworks' cmake configs looking for other things

Alex Merry alex.merry at kde.org
Sat Oct 11 15:05:52 UTC 2014


On Friday 10 Oct 2014 17:49:10 Harald Sitter wrote:
> Alohas
> 
> as described in [1] I think there is a bit of a problem how we track
> inter-dependencies in cmake configs right now (that is: the configs
> frameworks install to be found by 3rd party bits).
> 
> If I write a 3rd party software that does this:
> > find_package(KF5Runner)
> 
> it will eventually trigger this in KF5RunnerConfig.cmake:
> > find_dependency(KF5Plasma "5.3.0")
> 
> this in turn will look for Plasma *optionally*.
> 
> If plasma is not installed cmake will tell you:
> > -- The following OPTIONAL packages have not been found:
> >  * KF5Plasma (required version >= 5.3.0)
> 
> KF5Runner will be found all the same and it will try to build my runner
> plugin.
> 
> BUT one actually can not build a runner plugin without having plasma
> present, so the find_dependency in KF5RunnerConfig.cmake really should
> not have been optional but required.
> 
> Apparently this optionalism is the case in all frameworks' cmake
> configs and essentialy renders the find_dependency stuff utterly
> useless. It might as well not tell me that something was optionally
> looking for plasma as it will fail on make all the same.
> 
> What's the correct solution to this?

Hmm, yes. The current thing is that dependencies inherit their callers 
required status, so if KF5Runner is REQUIRED, so is KF5Plasma, and if 
KF5Runner is optional, so is KF5Plasma. This is not quite what we want. The 
FOUND status of dependencies should follow through to the FOUND status of 
callers - even if KF5RunnerConfig.cmake exists, it should set KF5Runner_FOUND 
to FALSE if KF5Plasma_FOUND is not TRUE after doing find_package(KF5Runner) 
(which is what find_dependency does internally).

Note that this also affects CMake upstream, as it provides find_dependency() via 
the CMakeFindDependencyMacro module.

I'll have to investigate a good way of doing this, but at the moment, all my 
computers are broken to some degree, so development is a little difficult.

Alex

Alex



More information about the Kde-frameworks-devel mailing list