[cmake-developers] Setting ExactCase_FOUND in FPHSA

Alexander Neundorf neundorf at kde.org
Tue Feb 19 14:45:05 EST 2013


On Monday 18 February 2013, Brad King wrote:
> On 02/18/2013 04:52 PM, Stephen Kelly wrote:
> > Anyway, I don't agree with your conclusion, but I guess Brad gets the
> > casting vote of doing nothing or not. I understand your position and you
> > understand mine I'm sure. All that's needed is to decide :).
> 
> One thing that has always bothered me about FPHSA is that modules
> using it have no mention of a _FOUND variable in the call to it.
> It is just magically set under the hood.  A module author needs
> to read FPHSA docs to know what _FOUND variable will be set.

well, it's more or less the main purpose of FPHSA to set the _FOUND variable, 
and handle the options (REQUIRED, QUIET, versions) consistently for all Find-
modules which use it.
 
> OTOH we already pass <pkg>_INCLUDE_DIR, <pkg>_LIBRARY, and other
> <pkg>_ variables to FPHSA:
> 
>  FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY)
> 
> so that it can check if everything is found.  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)
> 
> ?  Then it is clear when reading the call site what the _FOUND
> variable is called.  It also makes it clearer when reading the
> module when _FOUND is set.

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.

Well, FPHSA could error out if FOUND_VAR does not equal PackageName_FOUND or 
PACKAGENAME_FOUND, but this would be somewhat strange.

Alex



More information about the cmake-developers mailing list