CMP0164.rst 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. CMP0164
  2. -------
  3. .. versionadded:: 3.30
  4. :command:`add_library` rejects ``SHARED`` libraries when not supported by
  5. the platform.
  6. In CMake 3.29 and below, on platforms that do not support shared libraries
  7. (:prop_gbl:`TARGET_SUPPORTS_SHARED_LIBS` is false), the
  8. :command:`add_library` command automatically converts ``SHARED`` libraries to
  9. ``STATIC`` libraries to help users build projects on such platforms. However,
  10. the semantics of shared and static libraries are different enough that such
  11. automatic conversion cannot work in general. Projects using shared libraries
  12. need to be ported to such platforms on a case-by-case basis.
  13. In CMake 3.30 and above, :command:`add_library` prefers to reject creation
  14. of shared libraries on platforms that do not support them, and fail with a
  15. fatal error message. This policy provides compatibility for projects that
  16. happened to work with the automatic conversion to static libraries and have
  17. not been updated with an explicit port.
  18. The ``OLD`` behavior for this policy is to implicitly create a static
  19. library with a developer warning. The ``NEW`` behavior for this policy is
  20. to fail.
  21. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
  22. .. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn about the behavior change
  23. .. include:: include/STANDARD_ADVICE.rst
  24. .. include:: include/DEPRECATED.rst