[cmake-developers] How to handle package Config.cmake files with dependencies ?
Alexander Neundorf
neundorf at kde.org
Wed Mar 7 17:39:35 EST 2012
On Wednesday 07 March 2012, Brad King wrote:
> On 3/7/2012 9:49 AM, Michael Hertling wrote:
> > been found, but in module mode, AFAIK, it's set to Foo_DIR-NOTFOUND
> > even if a find module has succeeded
>
> The Foo_DIR variable is not set or added to the cache at all if
> a FindFoo module is loaded regardless of whether it succeeds.
> It is only if no FindFoo module is found that Foo_DIR appears.
>
> > my question is still: How can I figure out in a reliable manner
> > that FIND_PACKAGE(Foo ...) has found neither FindFoo.cmake nor
> > FooConfig.cmake?
>
> The call site should *know* whether it is intending to use a
> Find module or look for a package config file based on whether
> the the author adds a Find module to CMAKE_MODULE_PATH.
Yes.
> If using a Find module then use its documentation to check the
> result. FPHSA sets FOO_FOUND. Otherwise if using Config mode
> then check Foo_FOUND.
>
> Actually, the documentation of find_package says:
>
> <package>_FOUND will be set to indicate whether the package was found.
>
> Config mode *always* sets that. If it isn't set correctly
> by a Find module that is a bug in the Find module IMO.
Yes.
> FPHSA should be fixed to set both Foo_FOUND and FOO_FOUND.
> I know Alex always says that we should use UPPERCASE_VARS
> instead of ExactCase_VARS but the *ONLY* reason ever given
> is because "most" modules have done that historically.
Yes.
Beside that I don't have any preferences whether it should be ExactCase or
UPPER_CASE, I think both naming conventions are ok.
> That argument just extends the problem into the future as
> more and more new modules use the confusing convention.
If we all agree consciously that going with ExactCase is ok although the
majority of existing Find-modules uses UPPER_CASE then I won't object.
Alex
More information about the cmake-developers
mailing list