CMP0037.rst 1.5 KB

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