[CMake] How to install external project

David Cole david.cole at kitware.com
Fri Jul 13 21:01:43 EDT 2012


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/20120713/33df64d4/attachment.htm>


More information about the CMake mailing list