[CMake] What is the purpose of INSTALL_DIR in ExternalProject_Add command?
Cedric Doucet
cedric.doucet at inria.fr
Thu Apr 9 07:35:55 EDT 2015
Hello Ryan,
thank you for your answer.
If I understand it well, this exactly what I want.
I want third-party libraries to be installed in a specific location which does not correspond to the automatically generated one.
To do that, I can provide my own configuration command to install in MYDIR:
- for autoconfig: CONFIGURE_COMMAND ./configure --prefix=${MYDIR}
- for cmake: CONFIGURE_COMMAND cmake -D CMAKE_INSTALL_PREFIX=${MYDIR}
But, in this case, I don't use, and I do not have to use, the value of INSTALL_DIR.
Furhtermore, if I want to use INSTALL_DIR, I still need to provide my own configuration command.
So, my question is: what is INSTALL_DIR useful for?
Do you have an example where INSTALL_DIR is used without providing its own configuration command?
Because, if I need to provide such a command, INSTALL_DIR is useless.
Cédric
----- Mail original -----
> De: "Ryan Pavlik" <ryan.pavlik at gmail.com>
> À: "Cedric Doucet" <cedric.doucet at inria.fr>, "Iosif Neitzke"
> <iosif.neitzke+cmake at gmail.com>
> Cc: cmake at cmake.org
> Envoyé: Jeudi 9 Avril 2015 13:26:01
> Objet: Re: [CMake] What is the purpose of INSTALL_DIR in ExternalProject_Add
> command?
> It's for if your use case requires the project to be installed in a specific
> location that's not the automatically generated one. For instance, if you're
> building multiple external projects you might have them all install to the
> same subdirectory of the binary directory for convenience.
> Ryan
> On Thu, Apr 9, 2015, 6:07 AM Cedric Doucet < cedric.doucet at inria.fr > wrote:
> > Hello Iosif and David,
>
> > thank you for your answer.
>
> > I now understand how it works.
>
> > But I still don't understand the purpose of INSTALL_DIR.
>
> > Do you know an example when this variable is useful?
>
> > Cédric
>
> > ----- Mail original -----
>
> > > De: "Iosif Neitzke" < iosif.neitzke+cmake at gmail.com >
>
> > > À: cmake at cmake.org
>
> > > Envoyé: Jeudi 9 Avril 2015 12:54:28
>
> > > Objet: Re: [CMake] What is the purpose of INSTALL_DIR in
> > > ExternalProject_Add command?
>
> > >
>
> > > 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/ BuildingExternalProjectsWithCM
> > > ake2.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
>
> > > --
>
> > >
>
> > > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150409/d497f5c8/attachment.html>
More information about the CMake
mailing list