CMAKE_INSTALL_PREFIX.rst 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. CMAKE_INSTALL_PREFIX
  2. --------------------
  3. Install directory used by :command:`install`.
  4. If ``make install`` is invoked or ``INSTALL`` is built, this directory is
  5. prepended onto all install directories. This variable defaults to
  6. ``/usr/local`` on UNIX and ``c:/Program Files/${PROJECT_NAME}`` on Windows.
  7. See :variable:`CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT` for how a
  8. project might choose its own default.
  9. On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the
  10. whole installation. ``DESTDIR`` means DESTination DIRectory. It is
  11. commonly used by makefile users in order to install software at
  12. non-default location. It is usually invoked like this:
  13. ::
  14. make DESTDIR=/home/john install
  15. which will install the concerned software using the installation
  16. prefix, e.g. ``/usr/local`` prepended with the ``DESTDIR`` value which
  17. finally gives ``/home/john/usr/local``.
  18. WARNING: ``DESTDIR`` may not be used on Windows because installation
  19. prefix usually contains a drive letter like in ``C:/Program Files``
  20. which cannot be prepended with some other prefix.
  21. The installation prefix is also added to :variable:`CMAKE_SYSTEM_PREFIX_PATH`
  22. so that :command:`find_package`, :command:`find_program`,
  23. :command:`find_library`, :command:`find_path`, and :command:`find_file`
  24. will search the prefix for other software.
  25. .. note::
  26. Use the :module:`GNUInstallDirs` module to provide GNU-style
  27. options for the layout of directories within the installation.