[kdepimlibs] /: Interim hack to make everything which depends on kdepimlibs build again.

Alexander Neundorf neundorf at kde.org
Thu Dec 20 16:12:18 UTC 2012


On Thursday 20 December 2012, Andreas Pakulat wrote:
> Hi,
> 
> On Thu, Dec 20, 2012 at 2:47 PM, Christophe Giboudeaux
> 
> <cgiboudeaux at gmx.com> wrote:
> > On Thursday 20 December 2012 14:12:17 Yury G.  Kudryashov wrote:
> >> Ben Cooksley wrote:
> >> > On Thu, Dec 20, 2012 at 9:02 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> >> >> nepomuk is not found. If kdepimlibs libraries expose Nepomuk API in
> >> >> their own public API then its a dependency of kdepimlibs, this is
> >> >> expressed by having nepomuk in the link-interface of the kdepimlibs
> >> > 
> >> > Right. I guess the correct fix in this case is an if() block which
> >> > checks if Nepomuk had previously been found (and if so - adds the line
> >> > in with REQUIRED) and otherwise skips it.
> >> > 
> >> > I'll take a look into that.
> >> 
> >> I've missed this thread, and committed
> >> de3a6c213202e028a97ab5081e94468bc65c9868.
> >> 
> >> It adds
> >> +if(NOT TARGET nepomukcore)
> >> +   find_package(NepomukCore NO_MODULE)
> >> +endif()
> >> to KdepimLibsConfig.cmake.in. NepomukCore is Required by kdepimlibs
> >> (look at CMakeLists.txt in master and KDE/4.10, not in rc1).
> >> 
> >> I don't think that adding REQUIRED is the right thing to do. Probably,
> >> if(NOT TARGET nepomukcore)
> >> 
> >>    if(KdepimLibs_FIND_REQUIRED)
> >>    
> >>       find_package(NepomukCore REQUIRED NO_MODULE)
> >>    
> >>    else()
> >>    
> >>       find_package(NepomukCore NO_MODULE)
> >>    
> >>    endif()
> >> 
> >> endif()
> > 
> > Generally speaking, I'm against using find_package() in config files or I
> > see no valid reason to only look for nepomukcore, you should also look
> > for KDE4, Qt4, phonon and qjson which are all listed in
> > KDEPimLibsLibraryTargetsWithPrefix and why not extend it to build
> > dependencies and add libical, boost and all other dependencies ?
> 
> The config file should indeed ensure that all targets it needs are
> being set up, so yes you should also have a find_package(KDE4) in
> there. You don't need one for Qt4 since KDE4 requires Qt4 and hence
> searches for it. If kdelibs require nepomuk these days then you
> wouldn't need the extra find_package(Nepomuk) either when doing a
> find_package(KDE4).

Yes.
So, the Config file should:
* make sure all required packages (targets) are present, i.e.
 it should search for the packages it needs, but only if they have not yet 
been found

* only error out if it was searched using REQUIRED (as in the snippet above), 
otherwise just set FOUND to FALSE

* if it has optional dependencies, configure a switch into the Config.cmake 
file which keeps that information, and search for this optional dependency 
only if it is used


So something like this in the Config.cmake.in:

set(Foo_WITH_SOME_OPTIONAL_LIB @WITH_OPTIONAL_LIB@ )

if (Foo_WITH_SOME_OPTIONAL_LIB)
  if(NOT OPTIONAL_LIB_FOUND)
    set(requiredArg "")
    if(Foo_FIND_REQUIRED)
      set(requiredArg "REQUIRED")
    endif()
    find_package(OptionalLib ${requiredArg} )
  endif()
endif()

Alex


More information about the Kde-buildsystem mailing list