maco_optional_find_package magic

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Fri Mar 13 19:07:37 CET 2009


Jeff Mitchell schrieb:
> Alexander Neundorf wrote:
>> 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.
> 
> Yes, I know.
> 
>> So you could just copy that file into your project and use it.
> 
> Or use its 5 lines of code, which I said is what I tried doing.
> 
>> If you use it with the keyword REQUIRED, it will also fail with FATAL_ERROR if 
>> the package is not found.
> 
> I said that I wasn't.
> 
>> 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.
> 
> Okay, let me restate my question, since it was totally ignored.
> 
> When macro_optional_find_package is used, if a package is not found,
> CMake finishes configuring and writes build files.
> 
> If you simply use find_package, even if you are *not* using REQUIRED, if
> a package is not found, CMake finishes configuring but does *not* write
> build files, saying that an error had occurred.
> 
Which package do you mean? Looks like it's broken as this should not happen.


Christian


More information about the Kde-buildsystem mailing list