1
0

CMP0037.rst 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. CMP0037
  2. -------
  3. Target names should not be reserved and should match a validity pattern.
  4. CMake 2.8.12 and lower allowed creating targets using :command:`add_library`,
  5. :command:`add_executable` and :command:`add_custom_target` with unrestricted
  6. choice for the target name. Newer cmake features such
  7. as :manual:`cmake-generator-expressions(7)` and some
  8. diagnostics expect target names to match a restricted pattern.
  9. Target names may contain upper and lower case letters, numbers, the underscore
  10. character (``_``), dot(``.``), plus(``+``) and minus(``-``).
  11. As a special case, ``ALIAS`` and ``IMPORTED`` targets may contain
  12. two consecutive colons.
  13. Target names reserved by one or more CMake generators are not allowed.
  14. Among others these include ``all``, ``clean``, ``help``, and ``install``.
  15. Target names associated with optional features, such as ``test`` and
  16. ``package``, may also be reserved. CMake 3.10 and below always reserve them.
  17. CMake 3.11 and above reserve them only when the corresponding feature is
  18. enabled (e.g. by including the :module:`CTest` or :module:`CPack` modules).
  19. The ``OLD`` behavior for this policy is to allow creating targets with
  20. reserved names or which do not match the validity pattern.
  21. The ``NEW`` behavior for this policy is to report an error
  22. if an add_* command is used with an invalid target name.
  23. This policy was introduced in CMake version 3.0. CMake version
  24. |release| warns when the policy is not set and uses ``OLD`` behavior. Use
  25. the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
  26. .. include:: DEPRECATED.txt