Created
February 23, 2012 00:54
-
-
Save jcfr/1888836 to your computer and use it in GitHub Desktop.
Small example illustrating how CMake function scope works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(myfunc) | |
set(foo "myfunc") | |
message("Line ${CMAKE_CURRENT_LIST_LINE} - foo: ${foo} [scope: myfunc]") | |
endfunction() | |
function(myfunc_parent_scope) | |
set(foo "myfunc_parent_scope" PARENT_SCOPE) | |
message("Line ${CMAKE_CURRENT_LIST_LINE} - foo: ${foo} [scope: myfunc_parent_scope]") | |
endfunction() | |
set(foo "foo") | |
message("Line ${CMAKE_CURRENT_LIST_LINE} - foo: ${foo} [scope: global]") | |
myfunc() | |
message("Line ${CMAKE_CURRENT_LIST_LINE} - foo: ${foo} [scope: global]") | |
myfunc_parent_scope() | |
message("Line ${CMAKE_CURRENT_LIST_LINE} - foo: ${foo} [scope: global]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment