[cmake-developers] Setting ExactCase_FOUND in FPHSA

Alexander Neundorf neundorf at kde.org
Tue Feb 19 16:59:31 EST 2013


On Tuesday 19 February 2013, Matthew Woehlke wrote:
> On 2013-02-19 16:21, Alexander Neundorf wrote:
> > On Tuesday 19 February 2013, Matthew Woehlke wrote:
> >> On 2013-02-19 15:09, Alexander Neundorf wrote:
> >>> I don't see where automatically setting ExactCase_FOUND improves over
> >>> the current situation.
> >>> 
> >>> Right now, as a user of a Find-module you can only rely on the
> >>> variables as documented for each Find-module.
> >> 
> >> This sounds like a bug.
> > 
> > No, this is no bug. There is nothing else a Find-module could comply to,
> > than its own documentation.
> 
> Right. That sounds like a bug (or design flaw, if you prefer). At least,
> it doesn't strike me as something that can't be improved.
> 
> What is the problem defining an expected behavior, and then pushing find
> modules towards conforming to that?

this is already the case, that's the purpose of the readme.txt which exists 
since a long time, and this is the purpose of FPHSA, which I added I think in 
2007.
But there is nothing that enforces those conventions.
Users have to read the documentation, and hopefully as many Find-modules as 
possible follow the guidelines.

But since nothing *guarantees* that any arbitrary Find-module uses FPHSA, and 
more concrete the FPHSA coming with cmake and not a copy of it (which we had 
in kdelibs until recently), making FPHSA do something automatically does not 
help.

So, FindBZip2.cmake today sets BZIP2_FOUND as is stated in the docs.
I just had a look at the implementation, it uses FPHSA.
If we would change FPHSA to also set BZip2_FOUND, *nothing* would force us to 
touch FindBZip2.cmake, so the documentation may stay unchanged (even more so 
for Find-modules outside cmake). Now a developer using cmake 2.8.11 may, maybe 
accidentially, i.e. without checking the unchanged documentation, use 
BZip2_FOUND and sees it works for him. So he thinks its fine. There is no 
mention in the docs of BZip2_FOUND, so why should he figure that this means he 
now requires cmake 2.8.11 ?
Not even the documentation for find_package() can say that.
At best it could say something like
"Many Find-modules use FPHSA(), and those will set PackageName_FOUND. Check 
the documentation of the module in question to see whether this applies to the 
modules you are using."

E.g. in kdelibs we have a FindExiv2.cmake, it uses FPHSA and sets EXIV2_FOUND.
If FPHSA would set Exiv2_FOUND automatically, FindExiv2.cmake could not even 
document that.
It would have to say
"when used with cmake >= 2.8.11, it also sets BZip2_FOUND".
But even this would require that the author/maintainer of the Find-module is 
aware of this change in cmake, and actually changes the documentation 
accordingly.

The situation is *much* better if this is not done automatically, but on 
explicit request.
Then if the author decides he wants to use ExactCase_FOUND, it is a deliberate 
decision, he edits the file to add the necessary option when calling FPHSA, 
and at the same time he can adapt the documentation.

Alex



More information about the cmake-developers mailing list