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

David Cole david.cole at kitware.com
Fri Sep 21 13:44:52 EDT 2012


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.


On Fri, Sep 21, 2012 at 11:39 AM, David Doria <daviddoria at gmail.com> wrote:

> Is there a way to use the FORCE argument to set() without resetting
> the docstring? I tried:
>
> cmake_minimum_required(VERSION 2.6)
> PROJECT(CacheForce)
>
> # Create a variable
> set(MyVariable OFF CACHE BOOL "Description goes here." FORCE)
>
> # Change the value
> set(MyVariable ON CACHE FORCE) # error: "set given invalid arguments
> for CACHE mode." . I was hoping not to have to re-specify the type
> (BOOL) either.
>
> It seems like it is just asking for things to get out of sync by
> having to set the docstring in more than one place.
>
> Is there a way to do this?
>
> Thanks,
>
> David
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120921/3ecba24d/attachment.htm>


More information about the CMake mailing list