[CMake] 'uncaching' a path found by the find_XXX functions

J.S. van Bethlehem j.s.van.bethlehem at astro.rug.nl
Thu Apr 14 08:24:24 EDT 2011


Michael Wild wrote:
> On 04/14/2011 12:46 PM, J.S. van Bethlehem wrote:
>   
>> Dear users,
>>
>> As a new user CMake I've come across some things I don't fully
>> understand yet. Here is such a thing:
>> When a library consists of multiple separate lib-files, from the
>> archives it seems that the way to go when writing a 'Find'-module for
>> such a library, say library LIB, is first find each lib-file separately:
>> find_library(${LIB1_PATH} ${LIB1} ${SEARCH_PATH})
>> find_library(${LIB2_PATH} ${LIB2} ${SEARCH_PATH})
>> etc.
>> Then, when each of these were successfully found, do:
>> set(LIB_LIBRARIES ${LIB1_PATH} ${LIB2_PATH} [other library files] )
>>
>> But now I want LIB_LIBRARIES do become cached - that can be done with
>> the CACHE option. But I also want the ${LIBX_PATH} variables NOT to be
>> cached. How do I accomplish that? And is this indeed the right way to go
>> with CMake?
>>
>> Yours sincerely,
>> Jakob van Bethlehem
>>     
>
> Wrong, you never cache the XXX_LIBRARIES and XXX_INCLUDE_DIRS variables
> and leave the XXX_LIBRARY and XXX_INCLUDE_DIR variables cached. The
> former is for the use in the calling CMakeLists.txt file, while the
> latter are to be modified by your user in the CMakeCache.txt file. If
> you "uncached" them (why, by the way?), they wouldn't survive a
> re-configure and your user wouldn't have a chance to specify a different
> location.
>
> For more information, read the Modules/readme.txt file in your CMake
> installation.
>
> Michael
> _______________________________________________
> 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
>   
Thanks for the detailed explanation and the hint for the readme.txt 
file. That helped a lot.
Greetsz, Jakob


More information about the CMake mailing list