CMP0119.rst 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. CMP0119
  2. -------
  3. .. versionadded:: 3.20
  4. :prop_sf:`LANGUAGE` source file property explicitly compiles as specified
  5. language.
  6. The :prop_sf:`LANGUAGE` source file property is documented to mean that the
  7. source file is written in the specified language. In CMake 3.19 and below,
  8. setting this property causes CMake to compile the source file using the
  9. compiler for the specified language. However, it only passes an explicit
  10. flag to tell the compiler to treat the source as the specified language
  11. for MSVC-like, XL, and Embarcadero compilers for the ``CXX`` language.
  12. CMake 3.20 and above prefer to also explicitly tell the compiler to use
  13. the specified language using a flag such as ``-x c`` on all compilers
  14. for which such flags are known.
  15. This policy provides compatibility for projects that have not been updated
  16. to expect this behavior. For example, some projects were setting the
  17. ``LANGUAGE`` property to ``C`` on assembly-language ``.S`` source files
  18. in order to compile them using the C compiler. Such projects should be
  19. updated to use ``enable_language(ASM)``, for which CMake will often choose
  20. the C compiler as the assembler on relevant platforms anyway.
  21. The ``OLD`` behavior for this policy is to interpret the ``LANGUAGE <LANG>``
  22. property using its undocumented meaning to "use the ``<LANG>`` compiler".
  23. The ``NEW`` behavior for this policy is to interpret the ``LANGUAGE <LANG>``
  24. property using its documented meaning to "compile as a ``<LANG>`` source".
  25. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.20
  26. .. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
  27. .. include:: include/STANDARD_ADVICE.rst
  28. .. include:: include/DEPRECATED.rst