Looking at the following file may be helpful .. <a href="http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/SuperBuild/External_CLAPACK.cmake?view=markup">SuperBuild/External_CLAPACK.cmake</a><br>There are also other examples in the <a href="http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/SuperBuild/">Superbuild</a> folder.<br>

<br>Hth<br>Jc<br><br><div class="gmail_quote">On Fri, Jul 1, 2011 at 8:10 AM, Michael Wild <span dir="ltr">&lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</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><div></div><div class="h5">On 07/01/2011 01:48 PM, Martin Köhler wrote:<br>
&gt; Hi,<br>
&gt; I&#39;m currently trying to  write a cmake script, which downloads some<br>
&gt; source code and compile it during the configuration step. In my case<br>
&gt; this I want to try it with BLAS from <a href="http://netlib.org" target="_blank">netlib.org</a> because it represents<br>
&gt; the problem in a good way ( and I need it for BLAS and similar<br>
&gt; structured source code). That background is: If a necessary library<br>
&gt; isn&#39;t found on the system, I will download the reference version and<br>
&gt; compile it.<br>
&gt;<br>
&gt; Therefore I wrote the following code:<br>
&gt;<br>
&gt; # Download and Build reference BLAS<br>
&gt; MESSAGE(STATUS &quot; --&gt; BUILD BLAS&quot;)<br>
&gt; file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)<br>
&gt; SET (BLAS_DIR ${CMAKE_BINARY_DIR}/build/BLAS)<br>
&gt; MESSAGE(STATUS &quot; --&gt; DOWNLOAD BLAS&quot;)<br>
&gt; file(DOWNLOAD <a href="http://www.netlib.org/blas/blas.tgz" target="_blank">http://www.netlib.org/blas/blas.tgz</a><br>
&gt; ${CMAKE_BINARY_DIR}/build/blas.tgz SHOW_PROGRESS)<br>
&gt; MESSAGE(STATUS &quot; --&gt; EXTRACT BLAS&quot;)<br>
&gt; execute_process(COMMAND tar xzf blas.tgz WORKING_DIRECTORY<br>
&gt; ${CMAKE_BINARY_DIR}/build/ )<br>
&gt; MESSAGE(STATUS &quot; --&gt; COMPILE BLAS: &quot;  &quot;${CMAKE_Fortran_COMPILER}<br>
&gt; ${CMAKE_FORTRAN_FLAGS} -c -O2 *.f  in  ${CMAKE_BINARY_DIR}/build/BLAS&quot; )<br>
&gt; execute_process(COMMAND &quot;${CMAKE_Fortran_COMPILER}<br>
&gt; ${CMAKE_FORTRAN_FLAGS} -c -O2 *.f&quot; WORKING_DIRECTORY<br>
&gt; ${CMAKE_BINARY_DIR}/build/BLAS/ )<br>
&gt; execute_process(COMMAND ar cr libblas.a *.f WORKING_DIRECTORY<br>
&gt; ${CMAKE_BINARY_DIR}/build/BLAS/)<br>
&gt;<br>
&gt;<br>
&gt; This works until the archive is extracted. The compile step seems to be<br>
&gt; not executed. The ar step claims that there is not such file *.f<br>
&gt;<br>
&gt;<br>
&gt; How can I get this running?<br>
&gt;<br>
&gt;<br>
&gt; best regards, Martin<br>
<br>
</div></div>Don&#39;t reinvent the wheel, use the ExternalProject module that comes with<br>
cmake-2.8 and newer.<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>+1 919 869 8849<br><br>