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

Robert Dailey rcdailey at gmail.com
Tue Nov 1 16:51:18 EDT 2011


Thanks, I didn't even think of doing it like that :)

This works great. Thanks!

---------
Robert Dailey


On Tue, Nov 1, 2011 at 3:46 PM, Fraser Hutchison <
fraser.hutchison at googlemail.com> wrote:

>  Hi Robert,
>
> I think you need something like:
>
>
> if( NOT COPY_DONE )
>     ....... do work ........
>     set( COPY_DONE true CACHE BOOL "This is my documentation" FORCE )
> endif()
>
> Cheers,
>
> Fraser.
>
>
>
> On 01/11/2011 18:37, Robert Dailey wrote:
>
> 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
>
>
> --
>
> 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/20111101/407d3b6c/attachment-0001.htm>


More information about the CMake mailing list