Hi, On Monday, 23. September 2013, 23:41:19, Roger Leigh wrote: > Another minor annoyance I've run into is that when I define a function and > make use of a global variable, it appears to expand the variable during > definition, rather than evaluating it when I call the function. Is it > possible to make the function evaluate the variable lazily at > invocation time rather than when defined?
Can you condense this into a compact example? Last time I checked, the variables defined at function definition time are not preserved: <begin cmake snippet> set( global_var "foo") set( global_cache_var "foo" CACHE STRING "undocumented") function(testclosure) message("global_var is ${global_var}") message("global_cache_var is ${global_cache_var}") endfunction() set( global_var "bar") set( global_cache_var "bar" ) testclosure() <end cmake snippet> yields: global_var is bar global_cache_var is bar Kind regards, Johannes -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake