Quantcast

"continue" to find file with find_file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

"continue" to find file with find_file

joe-25

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: "continue" to find file with find_file

Philip Lowman
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 <[hidden email]> 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

_______________________________________________
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
Loading...