<div dir="ltr">Brilliant! <div><br></div><div>your suggestion has worked!</div><div><br></div><div>Thank you so much</div><div><br></div><div>Edo</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 4, 2019 at 11:23 AM Eric Doenges <<a href="mailto:doenges@mvtec.com">doenges@mvtec.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 bgcolor="#FFFFFF">
On 04.09.2019 11:55, Edoardo Pasca wrote:<br>
<blockquote type="cite">
<div dir="ltr">Dear all,
<div><br>
</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag">I'm using ExternalProjectAdd to build an
external package. </div>
<div class="gmail-m_-1351993468092585081cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag">On the CONFIGURE_COMMAND I have to pass
some variables to the configure script in this form:</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag">configure CPPFLAGS="-I/dir/include
-L/dir/lib" </div>
<div class="gmail-m_-1351993468092585081cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag">To do this I use </div>
<div class="gmail-m_-1351993468092585081cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag">CONFIGURE_COMMAND ${CMAKE_COMMAND} -E
env ${CMAKE_BINARY_DIR}/configure CPPFLAGS="-I/dir/include
-L/dir/lib" </div>
<div class="gmail-m_-1351993468092585081cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag">However, when cmake issues that command
(you can see that with make VERBOSE=1) it wraps the CPPFLAGS
parameters with quotation marks (as below) and the configure
script fails</div>
<div class="gmail-m_-1351993468092585081cye-lm-tag"><br clear="all">
<div class="gmail-m_-1351993468092585081cye-lm-tag">
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag">configure
"CPPFLAGS=\"-I/dir/include -L/dir/lib\""</div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag">Below you can find
a minimal CMakeLists.txt to test this. </div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag">I'd appreciate any
help on how I'd remove those quotation marks.</div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag"> </div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag">Thanks</div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag"><br>
</div>
<div class="gmail-m_-1351993468092585081gmail-cye-lm-tag gmail-m_-1351993468092585081cye-lm-tag">Edo</div>
</div>
</div>
</div>
</blockquote>
<div class="gmail-m_-1351993468092585081moz-cite-prefix"><br>
</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix">What I do is let CMake handle this
itself by defining a (list) variable for the configure command:<br>
</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix"><br>
</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix">set(cmd
"${CMAKE_BINARY_DIR}/configure")</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix">list(APPEND cmd
"CPPFLAGS=-I/dir/include -L/dir/lib")</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix">ExternalProject_Add(...</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix"> CONFIGURE_COMMAND ${CMAKE_COMMAND} -E
env ${cmd}</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix"> ...)</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix"><br>
</div>
<div class="gmail-m_-1351993468092585081moz-cite-prefix">Since cmd is a list, CMake knows that
the -L/dir/lib belongs to the CPPFLAGS=-I/dir/include part, and
puts double quotes around the entire thing, e.g. the actual
command line will look something like this:<br>
</div>
<p><xxx>/configure "CPPFLAG=-Idir/include -L/dir/lib"
</p>
<div class="gmail-m_-1351993468092585081moz-cite-prefix">This works with GNU autoconf. I've
found that in general, dealing with quoting in ExternalProject_Add
is a gigantic pain, so if the method above is not sufficient, I
use configure_file or file(WRITE) to generate a shell script
(Linux) or batch file (Windows) with the correct parameters and
call that instead.<br>
</div>
<p>With kind regards,<br>
Eric Dönges<br>
</p>
<div class="gmail-m_-1351993468092585081moz-signature">
<div style="width:480px;text-align:left;font-family:Arial,Helvetica,sans-serif">
<p style="color:rgb(6,45,100);font-size:14px;text-align:left;font-family:Arial,Helvetica,sans-serif"><b>Dr. Eric Dönges
</b><br>
Senior Software Engineer
</p>
<p style="color:rgb(6,45,100);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif">MVTec Software
GmbH | Arnulfstr. 205 | 80634 Munich | Germany<br>
<a style="font-size:12px;font-family:Arial,Helvetica,sans-serif;color:rgb(6,45,100)" href="mailto:doenges@mvtec.com" target="_blank">doenges@mvtec.com</a>
| Tel: +49 89 457 695-0 | <a style="font-size:12px;font-family:Arial,Helvetica,sans-serif;color:rgb(6,45,100)" href="http://www.mvtec.com" target="_blank">www.mvtec.com</a>
</p>
<p style="color:rgb(6,45,100);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif"><img src="https://mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/newsletter-icon.png" valign="bottom" width="16" height="16"> <a style="font-size:12px;font-family:Arial,Helvetica,sans-serif;color:rgb(6,45,100);font-weight:bold" href="http://www.mvtec.com/newsletter" target="_blank">Sign up</a> for our
MVTec Newsletter!</p>
<p style="margin:0px;color:rgb(102,102,102);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif">Geschäftsführer:
Dr. Wolfgang Eckstein, Dr. Olaf Munkelt<br>
Amtsgericht München HRB 114695</p>
<p style="margin:0px;color:rgb(102,102,102);font-size:12px;text-align:left;font-family:Arial,Helvetica,sans-serif"> </p>
<img src="https://www.mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/mvtec-logo-line.png" alt="MVTec Software GmbH Logo"></div>
</div>
</div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Edo</div><div>I know you think you understand what you thought I said, but I'm not sure you realize that what you heard is not what I meant (prob. Alan Greenspan)<br>:wq</div></div></div></div></div>