Skip to content

Revert "specify language flag when source LANGUAGE property is set"

Revert !4780 (merged). The purpose of that change was to convert an explicit LANGUAGE source file property into an explicit language specification compiler flag like -x c. This seems reasonable since the property is documented as meaning "indicate what programming language the source file is". It is also needed to help compilers deal with non-standard source file extensions they don't recognize.

However, some projects have been setting LANGUAGE C on .S assembler source files to mean "use the C compiler". Passing -x c for them breaks the build because the .S sources are not written in C. These projects should be updated to use enable_language(ASM), for which CMake often chooses the C compiler as the assembler when using toolchains that support it (which would have to be the case for projects using the approach).

Revert the change for now to preserve the old behavior for such projects. We can re-introduce it with a policy in a future version of CMake.

Fixes: #21469 (closed)
Issue: #14516 (closed), #20716 (closed)
Backport: release

Merge request reports