GNUInstallDirs.cmake 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # - Define GNU standard installation directories
  2. # Provides install directory variables as defined for GNU software:
  3. # http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
  4. # Inclusion of this module defines the following variables:
  5. # CMAKE_INSTALL_<dir> - destination for files of a given type
  6. # CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
  7. # where <dir> is one of:
  8. # BINDIR - user executables (bin)
  9. # SBINDIR - system admin executables (sbin)
  10. # LIBEXECDIR - program executables (libexec)
  11. # SYSCONFDIR - read-only single-machine data (etc)
  12. # SHAREDSTATEDIR - modifiable architecture-independent data (com)
  13. # LOCALSTATEDIR - modifiable single-machine data (var)
  14. # LIBDIR - object code libraries (lib)
  15. # INCLUDEDIR - C header files (include)
  16. # OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
  17. # DATAROOTDIR - read-only architecture-independent data root (share)
  18. # DATADIR - read-only architecture-independent data (DATAROOTDIR)
  19. # INFODIR - info documentation (DATAROOTDIR/info)
  20. # LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
  21. # MANDIR - man documentation (DATAROOTDIR/man)
  22. # DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
  23. # Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
  24. # install() commands for the corresponding file type. If the includer does
  25. # not define a value the above-shown default will be used and the value will
  26. # appear in the cache for editing by the user.
  27. # Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
  28. # from the corresponding destination by prepending (if necessary) the value
  29. # of CMAKE_INSTALL_PREFIX.
  30. #=============================================================================
  31. # Copyright 2011 Nikita Krupen'ko <[email protected]>
  32. # Copyright 2011 Kitware, Inc.
  33. #
  34. # Distributed under the OSI-approved BSD License (the "License");
  35. # see accompanying file Copyright.txt for details.
  36. #
  37. # This software is distributed WITHOUT ANY WARRANTY; without even the
  38. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  39. # See the License for more information.
  40. #=============================================================================
  41. # (To distribute this file outside of CMake, substitute the full
  42. # License text for the above reference.)
  43. # Installation directories
  44. #
  45. if(NOT DEFINED CMAKE_INSTALL_BINDIR)
  46. set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
  47. endif()
  48. if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
  49. set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
  50. endif()
  51. if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
  52. set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
  53. endif()
  54. if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
  55. set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
  56. endif()
  57. if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
  58. set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
  59. endif()
  60. if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
  61. set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
  62. endif()
  63. if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
  64. set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "object code libraries (lib)")
  65. endif()
  66. if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
  67. set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
  68. endif()
  69. if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
  70. set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
  71. endif()
  72. if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
  73. set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
  74. endif()
  75. #-----------------------------------------------------------------------------
  76. # Values whose defaults are relative to DATAROOTDIR. Store empty values in
  77. # the cache and store the defaults in local variables if the cache values are
  78. # not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
  79. if(NOT CMAKE_INSTALL_DATADIR)
  80. set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
  81. set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
  82. endif()
  83. if(NOT CMAKE_INSTALL_INFODIR)
  84. set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
  85. set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
  86. endif()
  87. if(NOT CMAKE_INSTALL_LOCALEDIR)
  88. set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
  89. set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
  90. endif()
  91. if(NOT CMAKE_INSTALL_MANDIR)
  92. set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
  93. set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
  94. endif()
  95. if(NOT CMAKE_INSTALL_DOCDIR)
  96. set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
  97. set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
  98. endif()
  99. #-----------------------------------------------------------------------------
  100. mark_as_advanced(
  101. CMAKE_INSTALL_BINDIR
  102. CMAKE_INSTALL_SBINDIR
  103. CMAKE_INSTALL_LIBEXECDIR
  104. CMAKE_INSTALL_SYSCONFDIR
  105. CMAKE_INSTALL_SHAREDSTATEDIR
  106. CMAKE_INSTALL_LOCALSTATEDIR
  107. CMAKE_INSTALL_LIBDIR
  108. CMAKE_INSTALL_INCLUDEDIR
  109. CMAKE_INSTALL_OLDINCLUDEDIR
  110. CMAKE_INSTALL_DATAROOTDIR
  111. CMAKE_INSTALL_DATADIR
  112. CMAKE_INSTALL_INFODIR
  113. CMAKE_INSTALL_LOCALEDIR
  114. CMAKE_INSTALL_MANDIR
  115. CMAKE_INSTALL_DOCDIR
  116. )
  117. # Result directories
  118. #
  119. foreach(dir
  120. BINDIR
  121. SBINDIR
  122. LIBEXECDIR
  123. SYSCONFDIR
  124. SHAREDSTATEDIR
  125. LOCALSTATEDIR
  126. LIBDIR
  127. INCLUDEDIR
  128. OLDINCLUDEDIR
  129. DATAROOTDIR
  130. DATADIR
  131. INFODIR
  132. LOCALEDIR
  133. MANDIR
  134. DOCDIR
  135. )
  136. if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
  137. set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
  138. else()
  139. set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
  140. endif()
  141. endforeach()