[CMake] How to force value to cache variable without retyping doc string?

Robert Dailey rcdailey at gmail.com
Tue Nov 1 14:37:06 EDT 2011


There is a one-time operation I need CMake to perform the very first time a
user generates. This operation involves copying several files from a remote
server (third party libraries) and placing them in the binary dir.

Right now I'm attempting to do this via a cache variable:

set( COPY_DONE false CACHE BOOL "This is my documentation" )
if( NOT COPY_DONE )
    ....... do work ........
    set( COPY_DONE true )
endif()

I do not make this an INTERNAL cache variable because at any time the user
should be able to set COPY_DONE to false manually and it should recopy
everything, and then set it back to 'true'.

The code above does not work because I'm not using set( COPY_DONE true
............ FORCE ). But I have to resupply the docstring if I do it this
way.

Am I going about this the wrong way? Can anyone recommend a different
approach? If not, how can I do this without having to duplicate the doc
string?

---------
Robert Dailey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111101/c5689b28/attachment-0001.htm>


More information about the CMake mailing list