<div dir="ltr">I'm collecting sources and includes into a parent scope variable, and then attempting to use that variable to reference the right sources.<div>Sources get added to the list as ../(theirpath)/(source) so in the parent level I can simply replace "../" with "" and then they are relative in the right place.<br><div>This works; as far as, the includes, sources and defines get all collected into the top level, but when i try to remove the ../ the list gets converted into a string.</div><div><br></div><div># Create a list of things<br>set( SIMPLE_LIST -I../lib1/include -I../lib2/include -I../lib3/include )</div><div># set a variable using that list...<br>  set( AMALG_COMMAND echo ${SIMPLE_LIST}  )</div><div># this outputs COMMAND:echo;-I../lib1/include;-I../lib2/include;-I../lib3/include</div><div>  message( "COMMAND:${AMALG_COMMAND}")<br><br># replace ../ with nothing<br>STRING( REPLACE "../" "" SIMPLE_LIST ${SIMPLE_LIST} )</div><div># re-set a variable with the eventual command to run<br>  set( AMALG_COMMAND echo ${SIMPLE_LIST}  )</div><div># this outputs COMMAND:echo;-Ilib1/include -Ilib2/include -Ilib3/include</div><div>  message( "COMMAND:${AMALG_COMMAND}")<br><br></div></div><div>When that final command actually gets run in a </div><div>  add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/out.c   COMMAND ${AMALG_COMMAND}  )</div><div><br></div><div>Then the command is 'echo "-Ilib1/include -Ilib2/include -Ilib3/include"' which is incorrect.</div><div><br></div><div><br></div><div>I tried first LIST(JOIN) but that defiantly makes a string and doesn't help.</div><div>string(REPLACE " " ";" SIMPLE_LIST ${SIMPLE_LIST})  to try and reverse it back to a list doesn't seem to help...<br></div></div>