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

Cedric Doucet cedric.doucet at inria.fr
Thu Apr 9 05:17:32 EDT 2015


Hello!

I try to download, extract, configure, build and install a library with CMake.
My CMakeLists.txt contains the following lines:

cmake_minimum_required (VERSION 2.6)
project (example CXX)
set(CMAKE_VERBOSE_MAKEFILE ON)
include(ExternalProject)
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
  set(CMAKE_BUILD_FLAGS -j${N})
endif()
ExternalProject_Add(eigen
                    PREFIX third_party
                    DOWNLOAD_DIR third_party/eigen/download
                    SOURCE_DIR third_party/eigen/src
                    BINARY_DIR third_party/eigen/build
                    INSTALL_DIR third_party/eigen/install
                    DOWNLOAD_COMMAND wget http://bitbucket.org/eigen/eigen/get/3.2.4.tar.gz && tar xvzf 3.2.4.tar.gz -C ../src --strip-components=1
                   )

In this example, the installation step fails with the following error message:

CMake Error at cmake_install.cmake:38 (FILE):
  file cannot create directory: /usr/local/include/eigen3.  Maybe need
  administrative privileges.

It means that the value of INSTALL_DIR is not taken into account during the configuration process.

Why? What am I do wrong?

Thank you very much for your help.

Best regards,

Cédric Doucet


More information about the CMake mailing list