[CMake] custom_install-target with DESTDIR

Timenkov Yuri ytimenkov at gmail.com
Sun Jan 18 07:05:50 EST 2009


Actually, make install calls cmake in command mode to process
cmake_install.cmake file in binary dir. You can move your doxy into separate
component, and call cmake to process installation of particular component.
Something like:

 INSTALL(DIRECTORY html/
   DESTINATION /share/doc/${PROJECT_NAME}
   COMPONENT=doxy)

 ADD_CUSTOM_TARGET(installdoxy
   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
-DCMAKE_INSTALL_COMPONENT="doxy" VERBATIM )

Or you can:
1) escape dollar sign to prevent macro expansion at cmake time (but this is
unportable)
2) wrap this call to cmake in separate cmake script (use execute_process
instead), and call it with cmake -P command. This way, environment expansion
will be done during sub-script processing time, that is when you make your
target.

On Thu, Jan 15, 2009 at 12:08 AM, M G Berberich
<berberic at fmi.uni-passau.de>wrote:

> Hello,
>
> I want to have a target 'installdoxy' that essentially does
>
>  INSTALL(DIRECTORY html/
>    DESTINATION /share/doc/${PROJECT_NAME})
>
> when I call 'make DESTDIR=… installdoxy'. The above code, of course,
> does not work, because it installs during 'make install'
>
> Defining a custom target via
>
>  ADD_CUSTOM_TARGET(installdoxy
>    COMMAND ${CMAKE_COMMAND} -E copy_directory html
>    ${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME} VERBATIM )
>
> does not work either because the DESTDIR=…-magic seems to only work in
> 'make DESTDIR=… install' not in 'make DESTDIR=… installdoxy'. Using
>
>  $ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}
>
> does not work either, because '$ENV{DESTDIR}' is expanded while cmake
> runs, not while make does.
>
> So, any chance to define a custom install target that is usable with
> DESTDIR?
>
>        MfG
>        bmg
>
> --
> „Des is völlig wurscht, was heut beschlos- | M G Berberich
>  sen wird: I bin sowieso dagegn!"          | berberic at fmi.uni-passau.de
> (SPD-Stadtrat Kurt Schindler; Regensburg)  |
> www.fmi.uni-passau.de/~berberic <http://www.fmi.uni-passau.de/%7Eberberic>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090118/52c617a3/attachment-0001.htm>


More information about the CMake mailing list