diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGetSourceFilePropertyCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmSourceFile.cxx | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 5a477b9..5c1c8a5 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -24,10 +24,6 @@ bool cmGetSourceFilePropertyCommand::InitialPass( sf = this->Makefile->CreateSource(file); } if (sf) { - if (args[2] == "LANGUAGE") { - this->Makefile->AddDefinition(var, sf->GetOrDetermineLanguage()); - return true; - } const char* prop = nullptr; if (!args[2].empty()) { prop = sf->GetPropertyForUser(args[2]); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 738a1c0..5d738d5 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -272,6 +272,13 @@ const char* cmSourceFile::GetPropertyForUser(const std::string& prop) this->GetFullPath(); } + // Similarly, LANGUAGE can be determined by the file extension + // if it is requested by the user. + if (prop == propLANGUAGE) { + // The c_str pointer is valid until `this->Language` is modified. + return this->GetOrDetermineLanguage().c_str(); + } + // Perform the normal property lookup. return this->GetProperty(prop); } |