GENERATED prop: Simplify determining the language of a source file

This simplification will help the later following structural changes of
class `cmSourceFile`.
This commit is contained in:
Deniz Bahadir
2020-11-12 22:08:59 +01:00
parent ca4ce458a3
commit b14fe704f8

View File

@@ -55,16 +55,14 @@ std::string const& cmSourceFile::GetOrDetermineLanguage()
}
// Perform computation needed to get the language if necessary.
if (this->FullPath.empty() && this->Language.empty()) {
// If a known extension is given or a known full path is given
// then trust that the current extension is sufficient to
// determine the language. This will fail only if the user
// specifies a full path to the source but leaves off the
// extension, which is kind of weird.
if (this->Location.ExtensionIsAmbiguous() &&
if (this->Language.empty()) {
// If a known extension is given or a known full path is given then trust
// that the current extension is sufficient to determine the language. This
// will fail only if the user specifies a full path to the source but
// leaves off the extension, which is kind of weird.
if (this->FullPath.empty() && this->Location.ExtensionIsAmbiguous() &&
this->Location.DirectoryIsAmbiguous()) {
// Finalize the file location to get the extension and set the
// language.
// Finalize the file location to get the extension and set the language.
this->ResolveFullPath();
} else {
// Use the known extension to get the language if possible.