Separate building of subprojects inside modules Was: Re: Okular moving

Alexander Neundorf neundorf at kde.org
Wed Nov 22 22:55:14 GMT 2006


On Wednesday 22 November 2006 20:29, Leo Savernik wrote:
> Am Dienstag, 21. November 2006 21:50 schrieb Alexander Neundorf:
> > > What I mean is more like this:
> > > cd k3b
> > > cmake && make && make install
> >
> > It can be made work this way, but currently this isn't the case.
> > What has to be done to make it work:
> > -CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR may not be used, since they refer
> > to different directories depending on what is the base directory of the
> > project (i.e. keg/ vs. keg/k3b/). Instead PROJECT(k3b) has to be used and
> > then k3b_SOURCE_DIR and k3b_BINARY_DIR instead.
> >
> > - no module-global config.h may be used, instead all the required system
> > introspection has to be done inside keg/k3b/
> >
> > -it may not be relied on find_package() commands outside of keg/k3b/,
> > i.e. also not find_package(KDE4 REQUIRED). This would mean that
> > find_package(KDE4 REQUIRED) would have to be repeated in every
> > subproject. Many things are cache by cmake, so this might be not such a
> > big performance hit.
>
> Given that keg packages are self-contained, I think this is not too much of
> an issue.

Can you please add this as a feature request to b.k.o ?

> > I could also create a macro like optional_add_subdirectory(k3b), which
> > would do the following, in pseudo code:
> >
> > optional_add_subdirectory(<name>)
> > {
> >    if exists(<name>)
> >    {
> >       option(build_<name> "Build directory <name>" default=TRUE)
> >       if (build_<name>)
> >       {
> >          add_subdirectory(<name>)
> >       }
> >    }
> > }
> >
> > This would have the effect that you could disable everything else or also
> > simply delete it.
> > Would that be useful ?
>
> This is probably overkill. I fear that everybody will forget to call that
> macro for his app ;-). 

Going once through the toplevel CMakeLists.txt of every module and adjusting 
it there wouldn't be that much work.
And it would reduce the cmake time for developers who work only on one 
subproject of a bigger module, they can disable the other subdirs of they 
don't need them.

> I'd be enough if cmake could flexibly adapt to new
> subdirectories appearing and gracefully handle old subdirectories
> disappearing by simply rerunning cmake from the top.

Something like this ?
It could be wrapped in a macro like "macro_collect_all_subdirs()"

file(GLOB allDirEntries "*" )

foreach(dir ${allDirEntries})
   if (EXISTS ${dir}/CMakeLists.txt)
      add_subdirectory(${dir})
   endif (EXISTS ${dir}/CMakeLists.txt)
endforeach(dir)

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net




More information about the kde-core-devel mailing list