[CMake] How to install external project

Martin Vymazal martin.vymazal at vki.ac.be
Fri Jul 13 20:21:43 EDT 2012


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



More information about the CMake mailing list