[CMake] Recursive list append

Michael Wild themiwi at gmail.com
Tue Jul 6 04:49:58 EDT 2010


On 6. Jul, 2010, at 10:41 , Diablo 666 wrote:

> 
> If I use SET with PARENT_SCOPE, wouldn't this delete old entries? Say I have more than one subdirectory. Can I append entries from both subdirectories this way?


CMakeLists.txt:
###############
set(some_list val1 val2 val3)
add_subdirectory(subdir)
message(STATUS "some_list = ${some_list}")

subdir/CMakeLists.txt:
######################
# append in local scope
list(APPEND some_list val4 val5 val6)
# set in parent scope
set(some_list "${some_list}" PARENT_SCOPE)


Michael


More information about the CMake mailing list