[CMake] Modifying a variable's value without resetting the docstring

David Cole david.cole at kitware.com
Mon Sep 24 11:04:40 EDT 2012


On Sep 24, 2012, at 10:18 AM, David Doria <daviddoria at gmail.com> wrote:

>> Well, if ${_var} is already a cache variable, you can retrieve it's HELPSTRING property to see what was set as the original doc string. But if it's not, then there won't be one, and you'll be adding an undocumented option...
>> 
>>  http://cmake.org/cmake/help/v2.8.9/cmake.html#section_PropertiesonCacheEntries
> 
> 
> Thanks Dave, that'll work:
> 
>        get_property(currentHelpString CACHE "${_var}" PROPERTY HELPSTRING)
>        set(${_var} OFF CACHE BOOL ${currentHelpString} FORCE)

You might want to put quotes around ${currentHelpString} in case it resolves to the empty string.



More information about the CMake mailing list