Modular building of kde modules

Parker Coates parker.coates at gmail.com
Wed Mar 18 00:57:53 CET 2009


On Tue, Mar 17, 2009 at 17:32, Alexander Neundorf wrote:
> I just committed a patch to
> kdelibs/cmake/modules/MacroOptionalAddSubdirectory.cmake which lets you
> disable all subdirectories in one go, so that it is easier to enable only
> selected ones, e.g. for kdeutils:
> $cmake -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_kcalc <kdeutils_dir>
> ...
> This way you get a build which includes only kcalc.
>
> Actually of course it would be even nicer if you could just check out
> kdeutils/kcalc/ and just build that, but that requires more (although
> basically boilerplate) work from the developers.
> My impression is that using macro_add_optional_subdirectory() is at least the
> much easier way to go to do this.

I've often wished CMake had a construct equivalent to Python's "if
__name__ == '__main__' :" that would let you run certain code only if
the current file was being run as the "top level" CMakeLists.txt.

For example, my app Killbots is quite happy to be built as part of the
KDEGames module. But to build it as a standalone app would require
adding some setup and dependency checks to the CMake file. These are
normally performed by the module level CMake file, so blindly
including them in my app would lead to double checks the majority of
the time.

Parker


More information about the Kde-buildsystem mailing list