Welcome to the third part of this small series about new stuff in CMake 2.8.6, following the first and the second part.
Now there are cases, e.g. for packagers, in which a project should be built without an optional dependency, although the dependency is actually present, e.g. to build an image viewer without mng support, although the mng-library is installed.
In CMake there didn't exist such a feature, so in KDE 4 we have the macro macro_optional_find_package(), which wraps the
Now, since CMake 2.8.6, this is a builtin feature of the find_package() command.
$ cmake -DCMAKE_DISABLE_FIND_PACKAGE_JPEG=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2 <srcdir>
For the developer this means, it is not necessary anymore to use macro_optional_find_package() from KDE, but simply the normal find_package() command.
For the packager or user this means, any optional dependency of any CMake-based project can now be disabled using a standard way, via -DCMAKE_DISABLE_FIND_PACKAGE_Foo=TRUE .