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

David Doria daviddoria at gmail.com
Fri Sep 21 13:58:00 EDT 2012


On Fri, Sep 21, 2012 at 1:44 PM, David Cole <david.cole at kitware.com> wrote:
> You should avoid using FORCE in the first place.
>
> :-)
>
>
> But if you have to use it, then you should provide the type and
> documentation along with the call that uses FORCE. If you have multiple
> calls that require this information, consider using variables to eliminate
> the duplication and reference the variables from the multiple calls.

I am using FORCE to do this:

http://www.itk.org/Wiki/CMake/Tutorials/SettingVariableGroups

You can see that my set(...FORCE...) call occurs inside of a foreach:

set(${_var} OFF CACHE BOOL "test" FORCE)

I guess to use your suggestion of making a variable that stores the
docstring once and referencing it from multiple places I would have to
use the CMake map emulation for this
(http://www.cmake.org/Wiki/CMake:VariablesListsStrings#Emulating_maps)
? Sound like the right thing to do? Or is there an entirely better way
to go about this :) ?

Thanks,

David


More information about the CMake mailing list