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

David Doria daviddoria at gmail.com
Fri Sep 21 11:39:19 EDT 2012


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


More information about the CMake mailing list