[CMake] How to install external project

Martin Vymazal martin.vymazal at vki.ac.be
Sat Jul 14 09:37:10 EDT 2012


Hello, 

  thanks for your advice. Unfortunately, I must still be doing something 
wrong. Now I have this:

  make[3]: *** No rule to make target `install'.  Stop.

 My CMakeLists.txt is below.

cmake_minimum_required(VERSION 2.8)
project(OpenBlasTest)

include(ExternalProject)
ExternalProject_Add(Blas
   SOURCE_DIR ${CMAKE_SOURCE_DIR}/contrib/blas
   BUILD_IN_SOURCE 1
   CONFIGURE_COMMAND ""
   BUILD_COMMAND make
   INSTALL_DIR ${CMAKE_BINARY_DIR}/install
   CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install
)


Best regards,

  Martin Vymazal


On Friday 13 of July 2012 21:01:43 David Cole wrote:

If it builds with CMake, then just give it these arguments:


  INSTALL_DIR ${CMAKE_BINARY_DIR}/install
  CMAKE_ARGS
    -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>


and leave off the INSTALL_COMMAND, accepting the default install command that 
ExternalProject already uses. That should work everywhere.


The thing you're trying to do would work if you did it like this, without the 
double quotes:


  INSTALL_COMMAND cp 
${CMAKE_SOURCE_DIR}/contrib/blas/blas_LINUX.a ${CMAKE_BINARY_DIR}/



But obviously, that will only work where there's a "cp" command, and on Linux, 
since the blas_LINUX.a file probably only works on Linux. (And it generally 
doesn't work to simply copy library files around as an install step...)




HTH,
David




On Fri, Jul 13, 2012 at 8:21 PM, Martin Vymazal <martin.vymazal at vki.ac.be> 
wrote:

Hello,

 I would like to add blas as external project to my code (which already uses
cmake), and I'm playing with ExternalProject_Add

I downloaded blas and extracted its sources to the directory
${CMAKE_SOURCE_DIR}/contrib/blas

The compilation runs fine and generates blas_LINUX.a, but I cannot install the
library. For testing purposes, I would like to move it to the build tree. I
tried:

ExternalProject_Add(BlasTest
 ...
INSTALL_COMMAND "cp ${CMAKE_SOURCE_DIR}/contrib/blas/blas_LINUX.a
${CMAKE_BINARY_DIR}/"
)

Unfortunately, this fails:

/bin/sh: cp /home/martin/BlasExtProject/contrib/blas/blas_LINUX.a
/home/martin/BlasExtProject/build/: No such file or directory

This happens after running:
cd /home/martin/BlasExtProject/build
cmake ..
make

Could you please help me to get this right?
I'm not sure that this approach as a whole is a good practice. If it's not,
please suggest a better one.

Thank you.

Best regards,

  Martin Vymazal

--

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





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120714/211188bb/attachment.htm>


More information about the CMake mailing list