[CMake] Getting a FindXXX.cmake script to revert to using XXX_DIR on failure

Stefán Freyr Stefánsson stefan at ru.is
Fri Jun 20 16:10:45 EDT 2008


Hello.

I have a project that I'm building with CMake and I made my own cmake script 
for one of the libraries I'm using (the library is called YARP).

So I created a FindYARP.cmake file which checks whether YARP is installed on 
the computer. In my master CMakeLists.txt file I add it to the CMake path so 
that CMake finds it. This works fine given that YARP is installed globally on 
the computer.

What I want is to be able to specify a path to my YARP setup if FindYARP.cmake 
fails. YARP is built with CMake as well so there is a YARPConfig.cmake file 
in the directory.

I've tried to set the YARP_DIR environment variable to point to this location 
and the only way that works is if I remove the FindYARP.cmake file from the 
CMake path. In other words, the FindYARP.cmake script seems to be taking 
total control over the YARP_DIR environment variable, so even if 
FindYARP.cmake fails to find a YARP installation, the other way (using 
YARP_DIR) is not attempted.

Is there any way for me to have CMake revert to the YARP_DIR method if the 
FindYARP.cmake script is unsuccessful?

Kind regards, Stefan Freyr.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080620/f484278a/attachment.pgp>


More information about the CMake mailing list