[cmake-developers] Setting ExactCase_FOUND in FPHSA

Alexander Neundorf neundorf at kde.org
Mon Feb 18 12:25:56 EST 2013


On Monday 18 February 2013, Stephen Kelly wrote:
> Alexander Neundorf wrote:
> > On Friday 15 February 2013, Stephen Kelly wrote:
> >> Hi,
> >> 
> >> FindPackageHandleStandardArgs sets an uppercase found variable, but not
> >> an ExactCase_FOUND variable. This is inconsistent with how config files
> >> work. It also imposes on users the necessity that their FOUND variable
> >> is uppercase.
> > 
> > how about adding an option EXACTCASE, which modules which use ExactCase
> > can use, and so only one of the two variables is set ?
> 
> I think the ExactCase version needs to be set by default.

there is, whether we like it or not, currently no guarantee at all which 
variables will be set by a Find-module.
So to find out how to use a Find-module, the developer has to read the 
documentation, and there he'll find which variable he can use to check whether 
the package has been found or not.

Making FPHSA be default also set the ExactCase version does unfortunately not 
mean that all Find-modules will from now on always set the ExactCase_FOUND 
variable, because there is no guarantee that every Find-module uses FPHSA. Or 
it may use a copy FPHSA.cmake.

My point is: the developer should use only those variables from a Find-module 
which are documented for the specific module.
This means it must be an explicit action to enable the ExactCase_FOUND 
variable, and it must be added to the documentation of that module.

I mean, even if FPHSA would set ExactCase_FOUND always by default, there still 
would be no guarantee at all that after a 
find_package(Foo)
Foo_FOUND will be set, because as a user of that module I don't know whether 
it uses FPHSA or not. I have to read the documentation.

IMO it also is neither more pretty nor more logical to use

if( SomePackage_FOUND )
   include_directories( ${SOMEPACKAGE_INCLUDE_DIRS} )
   set( libs ${libs} ${SOMEPACKAGE_LIBRARIES} )
endif()


instead of 


if( SOMEPACKAGE_FOUND )
   include_directories( ${SOMEPACKAGE_INCLUDE_DIRS} )
   set( libs ${libs} ${SOMEPACKAGE_LIBRARIES} )
endif()



If somebody decides that his new Find-module will be ExactCase, fine, he will 
document that, and all the variables will be consistent ExactCase.

If a module maintainer decides to switch his module completely to ExactCase 
(while doing whatever necessary for backward compatibility), he can do so, and 
make all the variables including the _FOUND variable ExactCase.


So I think it should be an explicit switch.


Alex



More information about the cmake-developers mailing list