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

Reply via email to