<div dir="ltr">I know... just need to rebuild a new list... something like....<div><br></div><div> set( _ALL_INCLUDES )<br> foreach( INC ${ALL_INCLUDES})<br> string(REPLACE "../" "" INC ${INC})<br> LIST( APPEND _ALL_INCLUDES ${INC} )<br> endforeach( INC )<br> set( ALL_INCLUDES ${_ALL_INCLUDES})<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 12, 2019 at 3:10 AM J Decker <<a href="mailto:d3ck0r@gmail.com">d3ck0r@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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>
</blockquote></div>