maco_optional_find_package magic

Alexander Neundorf neundorf at kde.org
Fri Mar 13 18:46:53 CET 2009


On Friday 13 March 2009, Jeff Mitchell wrote:
> Can someone clue me in as to how macro_optional_find_package manages to
> not have the configure abort (at the end) if the package isn't found?  I
> thought it might be something in KDE4Defaults, but didn't find it in
> there either.
>
> I need to do a check before I add the KDE4 includes/find_package, so I
> can't use the macro (because I can't rely on KDE4 being installed)...but

The file MacroOptionalFindPackage.cmake can be used completely independent 
from the rest of KDE, there is nothing in it which depends on anything 
KDE-related.
So you could just copy that file into your project and use it.
If you use it with the keyword REQUIRED, it will also fail with FATAL_ERROR if 
the package is not found.
The one thing it does additionally compared to plain FIND_PACKAGE() is that it 
automatically provides an option WITH_<name_of_the_package>, which you can 
disable, then it will not even try to search for the package.

Alex


More information about the Kde-buildsystem mailing list