On Thu, Apr 30, 2009 at 8:41 PM, Bill O'Hara <[email protected]> wrote:

> Thanks for the suggestion - a useful trick to have. I'd love an automatic
> way to trigger it though rather than having to run make rebuild_cache or
> thiis unset of the variable.


You could simply do this...

unset(FOO_LIBRARY CACHE)
find_library(FOO ...)

In addition to slowing you down on every configure, this has the unfortunate
side effect, however, of making it impossible for the user to edit the cache
entry from within the CMake cache editor since it will be immediately unset
on the next configure.  This may not be a big issue for you though.

If you needed the ability for users to change cache entries, I suppose you
could use a couple of variables....

find_library(FOO_LIBRARY_OVERRIDE ...)
unset(FOO_LIBRARY_NO_EDIT)
find_library(FOO_LIBRARY_NO_EDIT ...)
mark_as_advanced(FOO_LIBRARY_NO_EDIT)
if(FOO_LIBRARY_OVERRIDE)
   set(FOO_LIBRARY ${FOO_LIBRARY_OVERRIDE})
else()
   set(FOO_LIBRARY ${FOO_LIBRARY_NO_EDIT})
endif()
# link against ${FOO_LIBRARY})


-- 
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

Reply via email to