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

Stefán Freyr Stefánsson stefan at ru.is
Mon Jun 23 07:15:49 EDT 2008


On Monday 23 June 2008 10:28:48 Mike Arthur wrote:
> On Friday 20 June 2008 21:10:45 Stefán Freyr Stefánsson wrote:
> > Is there any way for me to have CMake revert to the YARP_DIR method if
> > the FindYARP.cmake script is unsuccessful?
>
> What I do, for CLucene, is the following:
>
> if (NOT CLUCENE_LIBRARY)
>     add_subdirectory(CLucene)
>     set(CLUCENE_LIBRARY clucene-core)
> endif (NOT CLUCENE_LIBRARY)
>
> So this adds the CLucene subdirectory and pulls in the clucene-core target
> as a dependency whenever I reference CLUCENE_LIBRARY. I should probably do
> the same with includes...

Thanks for your reply.

I did manage to get around this by doing the following:

if (YARP_DIR)
  # YARP_DIR has been set and we let it override everything
  message( STATUS "YARP_DIR is set: ${YARP_DIR}")
  load_cache(${YARP_DIR})
else ... #Here I do everything as before.

This seems to work as far as CMake goes, unfortunately there's still some 
problem with performing the actual build but I think that's not a CMake 
issue.

Thanks again.

Best 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/20080623/2a69e9db/attachment.pgp>


More information about the CMake mailing list