[cmake-developers] Setting ExactCase_FOUND in FPHSA
Brad King
brad.king at kitware.com
Thu Feb 21 11:29:20 EST 2013
On 02/19/2013 02:45 PM, Alexander Neundorf wrote:
> On Monday 18 February 2013, Brad King wrote:
>> Why not also pass in the name of the _FOUND variable e.g.
>>
>> FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY
>> FOUND_VAR Foo_FOUND)
>
> I agree with this, OTOH the maintainer could now write
>
> # copy'n paste error ?
> FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR Bar_FOUND)
>
> # typo ?
> FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR foop_FOUND)
>
>
> which bypasses the effect of consistent naming of the _FOUND variable.
> This would not be the case with an option USE_EXACT_CASE or something similar.
Imagine reading FindFoo.cmake without being aware of FPHSA and
its role, as a user of such a module might do. The docs say
it sets Foo_FOUND but I do not see that name anywhere in the
implementation. I ask myself "Where is it set?".
Seeing the call:
FPHSA(Foo USE_ORIGINAL_CASE
REQUIRED_VARS FOO_INCLUDE_DIR FOO_LIBRARY)
I would have no idea what USE_ORIGINAL_CASE affects.
OTOH the call
FPHSA(Foo FOUND_VAR Foo_FOUND
REQUIRED_VARS FOO_INCLUDE_DIR FOO_LIBRARY)
is pretty clear that it does something related to the Foo_FOUND
mentioned in the documentation.
> Well, FPHSA could error out if FOUND_VAR does not equal PackageName_FOUND or
> PACKAGENAME_FOUND, but this would be somewhat strange.
IMO that would be better. It's not much different from a
C++ interface that accepts a named enumeration value instead
of an int.
-Brad
More information about the cmake-developers
mailing list