summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-11-19 20:19:36 (GMT)
committerBrad King <brad.king@kitware.com>2020-11-19 22:06:03 (GMT)
commit30aa715fac06deba7eaa3e6167cf34eb4d2521d0 (patch)
tree6c9b7ef3a46c7473dcf04ddb1fea147e8009319c /Source
parent1d1d78bbe1ed7113927fd0dd078741de3c722b14 (diff)
downloadCMake-30aa715fac06deba7eaa3e6167cf34eb4d2521d0.zip
CMake-30aa715fac06deba7eaa3e6167cf34eb4d2521d0.tar.gz
CMake-30aa715fac06deba7eaa3e6167cf34eb4d2521d0.tar.bz2
Revert "specify language flag when source LANGUAGE property is set"
Revert commit 74b1c9fc8e (Explicitly specify language flag when source LANGUAGE property is set, 2020-06-01, v3.19.0-rc1~722^2) and the lookup tables from its two immediate ancestors. 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 Issue: #14516, #20716
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx7
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmMakefileTargetGenerator.cxx7
-rw-r--r--Source/cmNinjaTargetGenerator.cxx11
4 files changed, 1 insertions, 32 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 1c7e4b1..7c36144 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -349,13 +349,6 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
if (language.empty()) {
language = "C";
}
-
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (source->GetProperty("LANGUAGE")) {
- lg->AppendFeatureOptions(flags, language, "EXPLICIT_LANGUAGE");
- }
-
std::string const& config =
lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 766ae72..b40d8ea 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -937,14 +937,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
default:
break;
}
-
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (sf->GetProperty("LANGUAGE")) {
- this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang,
- "EXPLICIT_LANGUAGE");
- }
-
const std::string COMPILE_FLAGS("COMPILE_FLAGS");
if (cmProp cflags = sf->GetProperty(COMPILE_FLAGS)) {
lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS));
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5f97d86..3c4f68c 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -573,13 +573,6 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Build the set of compiler flags.
std::string flags;
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (source.GetProperty("LANGUAGE")) {
- this->LocalGenerator->AppendFeatureOptions(flags, lang,
- "EXPLICIT_LANGUAGE");
- }
-
// Add language-specific flags.
std::string langFlags = cmStrCat("$(", lang, "_FLAGS", filterArch, ")");
this->LocalGenerator->AppendFlags(flags, langFlags);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 04d84a0..76df9f2 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -190,16 +190,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
}
}
- std::string flags;
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (source->GetProperty("LANGUAGE")) {
- this->LocalGenerator->AppendFeatureOptions(flags, language,
- "EXPLICIT_LANGUAGE");
- flags += " ";
- }
-
- flags += this->GetFlags(language, config, filterArch);
+ std::string flags = this->GetFlags(language, config, filterArch);
// Add Fortran format flags.
if (language == "Fortran") {