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

Iosif Neitzke iosif.neitzke+cmake at gmail.com
Thu Apr 9 06:54:28 EDT 2015


Install Step
The INSTALL_DIR is underneath the calling project’s binary directory.
Use INSTALL_DIR to specify a different location. Note that in addition
to setting INSTALL_DIR, you also have to pass -DCMAKE_INSTALL_PREFIX
or --prefix to the CMake or configure command. It is not used
automatically in the configure step since not all projects follow this
convention.

>From http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html

On Thu, Apr 9, 2015 at 5:44 AM, David Cole via CMake <cmake at cmake.org> wrote:
> You need to tell eigen where to install, probably as an argument to its
> configure step. If it builds with CMake, you can use:
>
>     -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
>
> as one of the CMake args. If it has a non-CMake configure step, you'll have
> to call that and pass in <INSTALL_DIR> as an argument.
>
>
> HTH,
> David C.
>
>
> On Thursday, April 9, 2015, Cedric Doucet <cedric.doucet at inria.fr> wrote:
>>
>>
>> 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
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list