[CMake] "continue" to find file with find_file

Philip Lowman philip at yhbt.com
Thu Jul 16 00:24:52 EDT 2009


You could try forcing the cache entry for the path to XXX_PATH-NOTFOUND (or
unset(XXX_PATH CACHE)) and by using GET_FILENAME_COMPONENT() try to remove
the path where the directory was found from a list that you're passing into
the find_path() call.  This probably wouldn't work for things specified in
CMAKE_PREFIX_PATH or for anything in the standard system paths, however, so
I'm very hesitant about suggesting the above at all.

Best practices for FindXXX probably should be not to try to recover from
this error.  Simply throw a very loud error to the user telling them that
the headers found in XXX_INCLUDE_DIR are too old and tell the user to fix
the problem (which he can do by modifying XXX_INCLUDE_DIR).  You can also
consider using XXX_INCLUDE_DIR/../lib as a hint for finding libraries.

On Wed, Jul 15, 2009 at 11:47 AM, joe <loeffel77 at yahoo.com> wrote:

>
> Hi,
> I am currently writing a FindXXX.cmake file which uses find_path to find
> an include path. Unfortunately it turns out that there might be several
> versions of the file in the PATHs/HINTS (e.g. several revisions of the
> package). (I handle this with test using the try_compile command).
>
> My question is the following:
> If I determine that the path which cmake found with "find_path" is not the
> one, I am looking for (i.e. wrong version), is there a way to "continue" the
> find_path comment, to get the next match for a specific file? Alternatively
> is there a way to explicitly exclude a path (in my case the path of the
> first match) for the find_path command?
>
> Cheers, Klaus
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090716/71109698/attachment.htm>


More information about the CMake mailing list