<div class="gmail_quote">On Mon, Feb 20, 2012 at 11:03 AM, Andrea Crotti <span dir="ltr">&lt;<a href="mailto:andrea.crotti.0@gmail.com">andrea.crotti.0@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    On 02/20/2012 03:50 PM, David Cole wrote:
    <blockquote type="cite">
      <div class="gmail_quote">On Mon, Feb 20, 2012 at 10:42 AM, Eric
        Noulard <span dir="ltr">&lt;<a href="mailto:eric.noulard@gmail.com" target="_blank">eric.noulard@gmail.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          2012/2/20 Andrea Crotti &lt;<a href="mailto:andrea.crotti.0@gmail.com" target="_blank">andrea.crotti.0@gmail.com</a>&gt;:<br>
          <div>
            <div>&gt; On 02/20/2012 03:15 PM, David Cole
              wrote:<br>
              &gt;<br>
              &gt;<br>
              &gt; Use:<br>
              &gt;<br>
              &gt;   COMMAND ls -l<br>
              &gt;<br>
              &gt; Not:<br>
              &gt;<br>
              &gt;   COMMAND &quot;ls -l&quot;<br>
              &gt;<br>
              &gt;<br>
              &gt; Yes thanks, I started using the &quot;&quot; because I noticed
              that sometimes they are<br>
              &gt; needed.<br>
              &gt; So suppose I want to split the options and the
              command, this:<br>
              &gt;<br>
              &gt; set(myoptions one two three)<br>
              &gt; set(mycmd ls -l)<br>
              &gt;<br>
              &gt; message(${mycmd} ${myoptions})<br>
              &gt;<br>
              &gt; will produce<br>
              &gt; ls-lonetwothree<br>
              &gt;<br>
              &gt; Which is not what I want, but with &quot; I get even a
              more strange result:<br>
              &gt; message(&quot;${mycmd} ${myoptions}&quot;)<br>
              &gt;<br>
              &gt; ls;-l one;two;three<br>
              &gt;<br>
              &gt; and in the list command I don&#39;t see any way to simply
              concatenate two lists,<br>
              &gt; so how should I merge two different lists to produce
              a command?<br>
              <br>
            </div>
          </div>
          You may avoid to create a list in the first place:<br>
          set(myoptions &quot;one two three&quot;)<br>
          instead of<br>
          set(myoptions one two three)<br>
          <br>
          see<br>
          cmake --help-command list<br>
          <br>
          or you can<br>
          string(REPLACE &quot;;&quot; &quot; &quot; stringopts &quot;${myoptions}&quot;)<br>
          message(STATUS &quot;${stringopts}&quot;)<br>
          <div>
            <div><br>
              <br>
              --<br>
              Erk<br>
              Membre de l&#39;April - « promouvoir et défendre le logiciel
              libre » -<br>
              <a href="http://www.april.org" target="_blank">http://www.april.org</a><br>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <div><br>
      </div>
      <div>If you have:</div>
      <div><br>
      </div>
      <div>  set(myoptions one two three)<br>
          set(mycmd ls -l)<br>
      </div>
      <div><br>
      </div>
      <div>Then:</div>
      <div><br>
      </div>
      <div>  COMMAND ${mycmd} ${myoptions}</div>
      <div><br>
      </div>
      <div>should give you what you expect. (Regardless of what the
        &quot;message&quot; command&#39;s output is.)</div>
      <div><br>
      </div>
    </blockquote>
    <br>
    <br></div></div>
    Ah yes you&#39;re probably right, I tried it and it works.<br>
    It would still be nice to understand how to pass generated lists to
    COMMAND, but that&#39;s a plus for<br>
    the moment, and apparently too hard to get right..<br>
  </div>

</blockquote></div><br><div>In add_custom_command, if you pass</div><div><br></div><div>  COMMAND some_command ${list_of_args}</div><div><br></div><div>then each element of the list ends up as a separate argument to your command.</div>
<div><br></div><div>If you pass:</div><div><br></div><div>  COMMAND some_command &quot;${list_of_args}&quot;</div><div><br></div><div>then  your command gets a single argument. If the list contains more than 1 element, then your argument will have semi-colons in it.</div>
<div><br></div>