summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFile.cxx
diff options
context:
space:
mode:
authorDeniz Bahadir <dbahadir@benocs.com>2020-11-12 21:08:59 (GMT)
committerDeniz Bahadir <dbahadir@benocs.com>2020-11-24 16:55:01 (GMT)
commitb14fe704f8fad5785f10f0d56c5b49a8e0e0e94c (patch)
tree2788de71e1cbc24fa298d0064e0b203e4266e44c /Source/cmSourceFile.cxx
parentca4ce458a3a14889b1018198b6580ddddfb039a5 (diff)
downloadCMake-b14fe704f8fad5785f10f0d56c5b49a8e0e0e94c.zip
CMake-b14fe704f8fad5785f10f0d56c5b49a8e0e0e94c.tar.gz
CMake-b14fe704f8fad5785f10f0d56c5b49a8e0e0e94c.tar.bz2
GENERATED prop: Simplify determining the language of a source file
This simplification will help the later following structural changes of class `cmSourceFile`.
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r--Source/cmSourceFile.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 39074a5..517b570 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -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.