[CMake] `cmake -P cmake_install.cmake` vs `make install`

Eric Noulard eric.noulard at gmail.com
Tue Apr 17 03:37:01 EDT 2007


2007/4/16, Mathieu Malaterre <mathieu.malaterre at gmail.com>:
> 'lo
>
>   I am trying to figure out what is the slight difference between :
>
> make install
>
>   and
>
> cmake -P cmake_install.cmake
>
>   After reading the Makefile I need to run the `preinstall` target. So
> my question is how do I do that ?
>
>   Right now I have:
>
>   ADD_CUSTOM_TARGET(deb_destdir_install
>     COMMAND DESTDIR=${CMAKE_BINARY_DIR}/debian_package cmake -P
> cmake_install.cmake
>     DEPENDS ${CMAKE_BINARY_DIR}/cmake_install.cmake
>     COMMENT "Building debian_package directory with DESTDIR"
>   )
>   #ADD_DEPENDENCIES(deb_destdir_install preinstall) # does not work

May be you could just launch "make install" ?
Something like:

ADD_CUSTOM_TARGET(deb_destdir_install
     COMMAND DESTDIR=${CMAKE_BINARY_DIR}/debian_package
${CMAKE_MAKE_COMMAND}  install
     COMMENT "Building debian_package directory with DESTDIR"
)

this way you may use DESTDIR and you don't need to describe dependencies
since make install will respawn cmake if needed.


A s a side note when you use 'cmake' or 'make' command in your CUSTOM_whatever
you should use

${CMAKE_CMAKE_COMMAND} for 'cmake'
and
${CMAKE_MAKE_COMMAND} for 'make'

this way you should get the commands initially discovered by cmake itself
and avoid facing mix & match version problem.
I did face the problem for 'make' where both gmake and make were installed...


-- 
Erk


More information about the CMake mailing list