[CMake] list( APPEND ) on a cache variable

Michael Wild themiwi at gmail.com
Thu Nov 10 09:22:57 EST 2011


On 11/10/2011 02:57 PM, Robert Dailey wrote:
> I have an internal cache variable and I want to append items to it in a
> FOR loop using FORCE. Can list( APPEND ) do this for me? If not, can
> someone show me an example of how this would be done? What are the
> performance implications of each solution?
> 
> ---------
> Robert Dailey

AFAIK if the cache variable is INTERNAL, you don't need FORCE.
list(APPEND) can't do this for you, but you can use a un-cached variable
to assemble the list in the loop, and the set the INTERNAL cache
variable after the loop finished.

Also, if the values in that variable are not supposed to be persistent
across multiple CMake runs, you might want to use a global property instead.


Michael


More information about the CMake mailing list