[CMake] Recursive list append
Michael Wild
themiwi at gmail.com
Tue Jul 6 04:17:56 EDT 2010
On 6. Jul, 2010, at 10:06 , Diablo 666 wrote:
>
> Hi,
>
> say I create a list in the top level CMakeLists.txt and call a subdirectory. The subdirectory should add some entries to the list, then the top level should use the full list. How can I accomplish this?
>
> Best regards,
> Andreas
Either use the PARENT_SCOPE option of the SET() command or, IMHO preferably, use a global property like this:
CMakeLists.txt:
###############
set_property(GLOBAL PROPERTY some_super_property val1 val2 val3)
add_subdirectory(subdir)
get_property(some_super_list GLOBAL PROPERTY some_super_property)
message(STATUS "some_super_list = ${some_super_list}")
subdir/CMakeLists.txt:
######################
set_property(GLOBAL APPEND PROPERTY some_super_property val4 val5 val6)
HTH
Michael
More information about the CMake
mailing list