[CMake] What is the purpose of INSTALL_DIR in ExternalProject_Add command?

Nils Gladitz nilsgladitz at gmail.com
Fri Apr 10 04:55:11 EDT 2015


On 04/10/2015 10:51 AM, Cedric Doucet wrote:
>
> Hello,
>
> I have tried to use INSTALL_DIR in the configuration command but I may do something wrong:
>
>    ExternalProject_Add(${LIBRARY}
>                        INSTALL_DIR ${CMAKE_BINARY_DIR}/external/${LIBRARY}/install
>                        DOWNLOAD_COMMAND wget http://bitbucket.org/eigen/eigen/get/${EIGEN_VERSION}.tar.gz && tar xvzf ${EIGEN_VERSION}.tar.gz -C ../src --strip-components=1
>                        CONFIGURE_COMMAND cd ../build && cmake -D CMAKE_INSTALL_PREFIX=${INSTALL_DIR} ../src
>                     )
>
> I get the following error message :
>
>      CMake Error at cmake_install.cmake:38 (FILE):
>        file cannot create directory: /include/eigen3.  Maybe need administrative
>        privileges.
>
> But if I replace INSTALL_DIR by its value in the configuration command,
>
>      CONFIGURE_COMMAND cd ../build && cmake -D CMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external/${LIBRARY}/install ../src
>
> everything works fine.
>
> Could you explain me how to use INSTALL_DIR?

Try "<INSTALL_DIR>" instead of "${INSTALL_DIR}".
<INSTALL_DIR> is a token that ExternalProject itself should expand 
rather than a regular variable expansion.

Nils


More information about the CMake mailing list