On 08/29/2017 12:21 PM, Robert Dailey wrote:
> 3. Second find_package() happens, but "AlreadyInCache" is true (line
> 28 in cmFindPathCommand.cxx) this time, so it doesn't search for it
> again.
> 
> Hard to tell where the bug is here. I'd argue that AlreadyInCache
> shouldn't be set to true since an exact version was not found>, and the
> next find_package() command should do a full path search. Is this a
> bug in the C++ code or the find module script? What determines the
> AlreadyInCache variable?

This is one of the problems with find modules.  The individual find_*
call result *was* found and is already cached.  There is no way to
tell that apart from the user setting it explicitly in the cache.
That it proved insufficient for FPHSA's version check is not the
concern of the find_ command.

The find_package "config" mode uses only a single result variable
and performs a version check before setting it, so it can do
multiple searches like that.  Find modules can't do that because
they need to search for things piecemeal.  At most they can report
at the end that whatever was found is not suitable.  In typical
use cases with only a single find_package call it is then up to
the user to correct the cached settings.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to