cmake-policies.7.rst 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. .. cmake-manual-description: CMake Policies Reference
  2. cmake-policies(7)
  3. *****************
  4. .. only:: html or latex
  5. .. contents::
  6. Introduction
  7. ============
  8. Policies in CMake are used to preserve backward compatible behavior
  9. across multiple releases. When a new policy is introduced, newer CMake
  10. versions will begin to warn about the backward compatible behavior. It
  11. is possible to disable the warning by explicitly requesting the OLD, or
  12. backward compatible behavior using the :command:`cmake_policy` command.
  13. It is also possible to request NEW, or non-backward compatible behavior
  14. for a policy, also avoiding the warning.
  15. The :command:`cmake_minimum_required` command does more than report an
  16. error if a too-old version of CMake is used to build a project. It
  17. also sets all policies introduced in that CMake version or earlier to
  18. NEW behavior. To manage policies without increasing the minimum required
  19. CMake version, the :command:`if(POLICY)` command may be used::
  20. if(POLICY CMP0990)
  21. cmake_policy(SET CMP0990 NEW)
  22. endif()
  23. This has the effect of using the NEW behavior with newer CMake releases which
  24. users may be using and not issuing a compatibility warning.
  25. The setting of a policy is confined in some cases to not propagate to the
  26. parent scope. For example, if the files read by the :command:`include` command
  27. or the :command:`find_package` command contain a use of :command:`cmake_policy`,
  28. that policy setting will not affect the caller by default. Both commands accept
  29. an optional ``NO_POLICY_SCOPE`` keyword to control this behavior.
  30. The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
  31. to determine whether to report an error on use of deprecated macros or
  32. functions.
  33. All Policies
  34. ============
  35. .. toctree::
  36. :maxdepth: 1
  37. /policy/CMP0000
  38. /policy/CMP0001
  39. /policy/CMP0002
  40. /policy/CMP0003
  41. /policy/CMP0004
  42. /policy/CMP0005
  43. /policy/CMP0006
  44. /policy/CMP0007
  45. /policy/CMP0008
  46. /policy/CMP0009
  47. /policy/CMP0010
  48. /policy/CMP0011
  49. /policy/CMP0012
  50. /policy/CMP0013
  51. /policy/CMP0014
  52. /policy/CMP0015
  53. /policy/CMP0016
  54. /policy/CMP0017
  55. /policy/CMP0018
  56. /policy/CMP0019
  57. /policy/CMP0020
  58. /policy/CMP0021
  59. /policy/CMP0022
  60. /policy/CMP0023
  61. /policy/CMP0024
  62. /policy/CMP0025
  63. /policy/CMP0026
  64. /policy/CMP0027
  65. /policy/CMP0028
  66. /policy/CMP0029
  67. /policy/CMP0030
  68. /policy/CMP0031
  69. /policy/CMP0032
  70. /policy/CMP0033
  71. /policy/CMP0034
  72. /policy/CMP0035
  73. /policy/CMP0036
  74. /policy/CMP0037
  75. /policy/CMP0038
  76. /policy/CMP0039
  77. /policy/CMP0040
  78. /policy/CMP0041