[CMake] Download and Build external dependencies

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Fri Jul 1 09:19:39 EDT 2011


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

Hth
Jc

On Fri, Jul 1, 2011 at 8:10 AM, Michael Wild <themiwi at gmail.com> wrote:

> On 07/01/2011 01:48 PM, Martin Köhler wrote:
> > Hi,
> > I'm currently trying to  write a cmake script, which downloads some
> > source code and compile it during the configuration step. In my case
> > this I want to try it with BLAS from netlib.org because it represents
> > the problem in a good way ( and I need it for BLAS and similar
> > structured source code). That background is: If a necessary library
> > isn't found on the system, I will download the reference version and
> > compile it.
> >
> > Therefore I wrote the following code:
> >
> > # Download and Build reference BLAS
> > MESSAGE(STATUS " --> BUILD BLAS")
> > file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
> > SET (BLAS_DIR ${CMAKE_BINARY_DIR}/build/BLAS)
> > MESSAGE(STATUS " --> DOWNLOAD BLAS")
> > file(DOWNLOAD http://www.netlib.org/blas/blas.tgz
> > ${CMAKE_BINARY_DIR}/build/blas.tgz SHOW_PROGRESS)
> > MESSAGE(STATUS " --> EXTRACT BLAS")
> > execute_process(COMMAND tar xzf blas.tgz WORKING_DIRECTORY
> > ${CMAKE_BINARY_DIR}/build/ )
> > MESSAGE(STATUS " --> COMPILE BLAS: "  "${CMAKE_Fortran_COMPILER}
> > ${CMAKE_FORTRAN_FLAGS} -c -O2 *.f  in  ${CMAKE_BINARY_DIR}/build/BLAS" )
> > execute_process(COMMAND "${CMAKE_Fortran_COMPILER}
> > ${CMAKE_FORTRAN_FLAGS} -c -O2 *.f" WORKING_DIRECTORY
> > ${CMAKE_BINARY_DIR}/build/BLAS/ )
> > execute_process(COMMAND ar cr libblas.a *.f WORKING_DIRECTORY
> > ${CMAKE_BINARY_DIR}/build/BLAS/)
> >
> >
> > This works until the archive is extracted. The compile step seems to be
> > not executed. The ar step claims that there is not such file *.f
> >
> >
> > How can I get this running?
> >
> >
> > best regards, Martin
>
> Don't reinvent the wheel, use the ExternalProject module that comes with
> cmake-2.8 and newer.
>
> Michael
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110701/dc0c162d/attachment.htm>


More information about the CMake mailing list