<div class="gmail_quote">On Fri, Jan 14, 2011 at 4:41 PM, Pau Garcia i Quiles <span dir="ltr">&lt;<a href="mailto:pgquiles@elpauer.org">pgquiles@elpauer.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Fri, Jan 14, 2011 at 9:52 PM, David Cole &lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt; wrote:<br>
&gt;&gt; - Add a PATH parameter to ExternalProject_Add,<br>
&gt;&gt; ExternalProject_Add_Step and execute_process. It should override the<br>
&gt;&gt; default path. Adding new directories to the path would be possible by<br>
&gt;&gt; doing PATH &quot;$ENV{PATH}:/my/new/dir/in/path&quot;<br>
&gt;<br>
&gt; Good suggestion. Actually, we&#39;ve wanted to add a feature to specify<br>
&gt; environment variables to arbitrary calls to add_custom_command for quite a<br>
&gt; while, but there are some subtle details behind it, and we haven&#39;t found the<br>
&gt; time and funding to get that done yet. This would be an easy pass-through<br>
&gt; from ExternalProject to such a feature as soon as the underlying feature<br>
&gt; exists in add_custom_command.<br>
<br>
</div>What are those subtle details?<br>
<div class="im"><br></div></blockquote><div><br>I don&#39;t have them written down... every time Brad and I discuss this topic, though, we go down the rabbit hole and find them again. Next time, I&#39;ll try to write them down somewhere so that I can answer this succinctly. (Sorry, I know this is a lame cop-out, but it&#39;s Friday afternoon...)<br>
<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
&gt;&gt; - Define variables for SOURCE_DIR, BINARY_DIR, etc even if EP_PREFIX<br>
&gt;&gt; and EP_BASE are not set<br>
&gt;<br>
&gt; Not sure what you mean here?<br>
&gt;<br>
&gt; If you got a ExternalProject_Get_Property(${proj} source_dir) immediately<br>
&gt; after an ExternalProject_Add call you can retrieve the value of its source<br>
&gt; dir regardless of if you have EP_PREFIX or EP_BASE set, right? Those only<br>
&gt; control some of the default layouts that we had come up with when trying to<br>
&gt; organize things.<br>
<br>
</div>For OpenSSL, I need to know ExternalProject_Get_Property(${proj}<br>
source_dir) *while* I am still in ExternalProject_Add. This is still<br>
work in progress but here is what I am doing now:<br>
<br>
ExternalProject_Add( openssl<br>
    DEPENDS zlib<br>
    DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/downloads<br>
    URL <a href="http://openssl.org/source/openssl-1.0.0c.tar.gz" target="_blank">http://openssl.org/source/openssl-1.0.0c.tar.gz</a><br>
    PATCH_COMMAND ${PROJECT_SOURCE_DIR}/bin/patch.exe -p1 &lt;<br>
${PROJECT_SOURCE_DIR}/downloads/openssl-1.0.0c.patch<br>
    CONFIGURE_COMMAND &quot;&quot;<br>
    BUILD_COMMAND ${CMAKE_COMMAND} -DWINST_DIR=${PROJECT_SOURCE_DIR}<br>
-DOPENSSL_SOURCE_DIR=${PROJECT_BINARY_DIR}/openssl-prefix/src/openssl/<br>
-DOPENSSL_GENASM_COMMAND=${OPENSSL_GENASM_COMMAND}<br>
-DOPENSSL_CONFIGURE_COMMAND=${OPENSSL_CONFIGURE_COMMAND}<br>
-DOPENSSL_BUILD_COMMAND=${OPENSSL_BUILD_COMMAND}<br>
-DOPENSSL_INSTALL_COMMAND=&quot;${OPENSSL_BUILD_COMMAND} install&quot; -P<br>
${PROJECT_SOURCE_DIR}/configure-openssl.cmake<br>
    BUILD_IN_SOURCE 1<br>
    )<br>
<br>
Where configure-openssl.cmake is generates the assembly code, runs<br>
perl Configure, nmake and nmake install. The relevant part here is<br>
<br>
-DOPENSSL_SOURCE_DIR=${PROJECT_BINARY_DIR}/openssl-prefix/src/openssl/<br>
<br>
in BUILD_COMMAND. OpenSSL must be built in-tree, which means you need<br>
to know where the source tree is while in the ExternalProject_Add<br>
call.<br>
<div class="im"><br></div></blockquote><div><br>So... just use &lt;SOURCE_DIR&gt; as part of a command, and it should substitute it for you... See <a href="http://cmake.org/cmake/help/cmake-2-8-docs.html#module:ExternalProject">http://cmake.org/cmake/help/cmake-2-8-docs.html#module:ExternalProject</a> -- specifically this section:<br>
<br>&quot;The command line, comment, and working directory of every standard and 
custom step is processed to replace tokens &lt;SOURCE_DIR&gt;, 
&lt;BINARY_DIR&gt;, &lt;INSTALL_DIR&gt;, and &lt;TMP_DIR&gt; with 
corresponding property values.&quot;<br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
&gt;&gt; - Allow for multiple CONFIGURE_COMMAND steps (I know, I can add my<br>
&gt;&gt; custom step, but it&#39;s much more complex)<br>
&gt;<br>
&gt; How many would you like? Why not just run a script as the single configure<br>
&gt; command, and then have your script do the multiple steps needed?<br>
<br>
</div>That&#39;s what I&#39;m currently doing, which is why I have the problem<br>
above: I need to know the source directory, the build directory, etc<br>
of that ExternalProject. That means you need to pass variables, set<br>
PATH, etc. It&#39;d be easier if an arbitrary number of CONFIGURE_COMMAND<br>
would be run in order before the BUILD_COMMAND.<br>
<div class="im"><br></div></blockquote><div><br>I&#39;ll think about it, but it&#39;s hard to see how an abitrary number of steps (that are not simply custom defined steps with their own names) would be readable in the ExternalProject_Add interface. It&#39;s very useful, but it&#39;s already, at its young age, quite crowded with parameters.<br>
<br>... &lt;Planting reminder seed deep into brain tissue. Water, nourish, and check back later.&gt; ...<br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">
&gt;&gt; Another more issue I&#39;m seeing with ExternalProject_Add is tarballs<br>
&gt;&gt; with symlinks on Windows. The OpenSSL contains symlinks, which leads<br>
&gt;&gt; to a broken source dir because CMake is unable to create some files.<br>
&gt;&gt; Maybe CMake should pass libarchive some parameter? (if I extract the<br>
&gt;&gt; OpenSSL tarball with WinRAR, it does not fail)<br>
&gt;<br>
&gt; What does WinRAR give you? Symlinks because the Windows you&#39;re using<br>
&gt; supports them? Or copies of the linked-to files in place of symlinks? Or<br>
&gt; something else?<br>
<br>
</div>Copies of the linked-to files in place of symlinks.<br></blockquote><div><br>Thanks for the info.<br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">Pau Garcia i Quiles<br>
<a href="http://www.elpauer.org" target="_blank">http://www.elpauer.org</a><br>
(Due to my workload, I may need 10 days to answer)<br>
</div></div></blockquote></div><br>