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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to