Is there a way to an updated variable from parent scope?

For example,
I am in a sub-directory

set(FOO 2 PARENT_SCOPE)

...

<still in sub-directory>
retrieve FOO from PARENT_SCOPE

I know sub-directory would get a copy of FOO, if it existed, when it
was entered.

I played with set/get_property() for this, but which worked ok until I
wanted to store a list

set(FOO a b c PARENT_SCOPE)
set_property(GLOBAL APPEND PROPERTY FOO-LIST FOO)
get_property(my-foo-list GLOBAL PROPERTY FOO-LIST)
foreach (e ${my-foo-list})
        message("TEST ${${e}}")
        message(TEST2="${e}")
endforeach()

This outputs:
TEST
TEST2="FOO"

Thanks
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to