CPACK_SET_DESTDIR.rst 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. CPACK_SET_DESTDIR
  2. -----------------
  3. Boolean toggle to make CPack use ``DESTDIR`` mechanism when packaging.
  4. ``DESTDIR`` means DESTination DIRectory. It is commonly used by makefile
  5. users in order to install software at non-default location. It is a
  6. basic relocation mechanism that should not be used on Windows (see
  7. :variable:`CMAKE_INSTALL_PREFIX` documentation). It is usually invoked like
  8. this:
  9. ::
  10. make DESTDIR=/home/john install
  11. which will install the concerned software using the installation
  12. prefix, e.g. ``/usr/local`` prepended with the ``DESTDIR`` value which
  13. finally gives ``/home/john/usr/local``. When preparing a package, CPack
  14. first installs the items to be packaged in a local (to the build tree)
  15. directory by using the same ``DESTDIR`` mechanism. Nevertheless, if
  16. ``CPACK_SET_DESTDIR`` is set then CPack will set ``DESTDIR`` before doing the
  17. local install. The most noticeable difference is that without
  18. ``CPACK_SET_DESTDIR``, CPack uses :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
  19. as a prefix whereas with ``CPACK_SET_DESTDIR`` set, CPack will use
  20. :variable:`CMAKE_INSTALL_PREFIX` as a prefix.
  21. Manually setting ``CPACK_SET_DESTDIR`` may help (or simply be necessary)
  22. if some install rules uses absolute ``DESTINATION`` (see CMake
  23. :command:`install` command). However, starting with CPack/CMake 2.8.3 RPM
  24. and DEB installers tries to handle ``DESTDIR`` automatically so that it is
  25. seldom necessary for the user to set it.