[CMake] Question about PARENT_SCOPE
Clinton Stimpson
clinton at elemtech.com
Mon May 3 15:00:49 EDT 2010
On Monday 03 May 2010 12:42:58 pm Benoit Thomas wrote:
> Hello,
>
> Is it possible to do something like this (sorry if there are typos):
>
> function (bar v scope)
> set (v 1 GRAND_PARENT_SCOPE)
> endfunction()
>
> function (foo v)
> bar (${v} PARENT_SCOPE)
> endfunction()
>
> foo (v)
> message ("${v} == 1")
>
> If it's not possible, I'll go with global variables. Currently, I do
> global variables by doing:
>
> set (v 1 CACHE INTERNAL "" FORCE)
>
> But is there a better way ?
Did you mean like this?
function (bar v)
set (${v} 1 PARENT_SCOPE)
endfunction()
function (foo v)
bar(v1)
set(${v} ${v1} PARENT_SCOPE)
endfunction()
foo (v)
message ("${v} == 1")
Clint
More information about the CMake
mailing list