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

David Doria daviddoria at gmail.com
Mon Sep 24 10:18:05 EDT 2012


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


More information about the CMake mailing list