[cmake-developers] find_package without REQUIRED can cause fatal error now
Brad King
brad.king at kitware.com
Tue Jul 31 16:00:02 EDT 2012
On 07/31/2012 03:54 PM, Alexander Neundorf wrote:
> On Tuesday 31 July 2012, Brad King wrote:
>> I think a better solution is to allow specific package locations
>> to be explicitly disallowed by the user. This gives them an
>> option to deal with broken packages if they are not an admin
>> on the machine capable of fixing it.
>
> They can already right now set CMAKE_DISABLE_FIND_PACKAGE_<package> to TRUE.
>
> Is this good enough ?
Yes, I think so. If a user wants a specific non-broken package to
be used then s/he can set <package>_DIR to that location to skip over
the broken one. If the user wants to disable the package then this
setting provides that option.
> (the documentation for this is at the very end of the find_package()
> documentation, maybe it should move up to one of the first paragraphs.
There is a lot of documentation in find_package. Something has to
be at the end. We can't repeatedly move up each thing that happens
to seem most pertinent at the moment.
Anyway, a user encountering such failure may be just trying to build
some software and not have written any CMake code. They will not
think to look at the documentation of find_package for a solution.
The failure message would have to suggest the solution. Perhaps we
just need to teach find_package to detect when the package is found
but the package configuration file generates an error. If the
package is optional it can generate a message suggesting use of
CMAKE_DISABLE_FIND_PACKAGE_<package>.
-Brad
More information about the cmake-developers
mailing list