[CMake] Functions inherit parent variables?

Robert Dailey rcdailey at gmail.com
Wed Feb 29 19:38:17 EST 2012


I ran a quick test:


function( test )
message( "SOME_TEST: ${SOME_TEST}" )
endfunction()

function( start )
set( SOME_TEST "HELLO WORLD" )
test()
endfunction()

start()


Seems like a function has access to the calling scope's defined variables.
I thought because functions created a new scope, that excluded access to
variables defined in the outer scope (i.e. calling scope)

Can someone explain?

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


More information about the CMake mailing list