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