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"><<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>></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>
> Hi,<br>
> I'm currently trying to write a cmake script, which downloads some<br>
> source code and compile it during the configuration step. In my case<br>
> this I want to try it with BLAS from <a href="http://netlib.org" target="_blank">netlib.org</a> because it represents<br>
> the problem in a good way ( and I need it for BLAS and similar<br>
> structured source code). That background is: If a necessary library<br>
> isn't found on the system, I will download the reference version and<br>
> compile it.<br>
><br>
> Therefore I wrote the following code:<br>
><br>
> # Download and Build reference BLAS<br>
> MESSAGE(STATUS " --> BUILD BLAS")<br>
> file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)<br>
> SET (BLAS_DIR ${CMAKE_BINARY_DIR}/build/BLAS)<br>
> MESSAGE(STATUS " --> DOWNLOAD BLAS")<br>
> file(DOWNLOAD <a href="http://www.netlib.org/blas/blas.tgz" target="_blank">http://www.netlib.org/blas/blas.tgz</a><br>
> ${CMAKE_BINARY_DIR}/build/blas.tgz SHOW_PROGRESS)<br>
> MESSAGE(STATUS " --> EXTRACT BLAS")<br>
> execute_process(COMMAND tar xzf blas.tgz WORKING_DIRECTORY<br>
> ${CMAKE_BINARY_DIR}/build/ )<br>
> MESSAGE(STATUS " --> COMPILE BLAS: " "${CMAKE_Fortran_COMPILER}<br>
> ${CMAKE_FORTRAN_FLAGS} -c -O2 *.f in ${CMAKE_BINARY_DIR}/build/BLAS" )<br>
> execute_process(COMMAND "${CMAKE_Fortran_COMPILER}<br>
> ${CMAKE_FORTRAN_FLAGS} -c -O2 *.f" WORKING_DIRECTORY<br>
> ${CMAKE_BINARY_DIR}/build/BLAS/ )<br>
> execute_process(COMMAND ar cr libblas.a *.f WORKING_DIRECTORY<br>
> ${CMAKE_BINARY_DIR}/build/BLAS/)<br>
><br>
><br>
> This works until the archive is extracted. The compile step seems to be<br>
> not executed. The ar step claims that there is not such file *.f<br>
><br>
><br>
> How can I get this running?<br>
><br>
><br>
> best regards, Martin<br>
<br>
</div></div>Don'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>