diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2018-12-13 19:44:58 (GMT) |
---|---|---|
committer | Artur Ryt <artur.ryt@gmail.com> | 2018-12-28 14:16:37 (GMT) |
commit | 5257af363442aa4168776b70db1fc58d218a20c8 (patch) | |
tree | 0e59c2ddfb80bdffde58282f02f69100847d6f0b /Source/cmMakefile.cxx | |
parent | f564f65ff551932aa17a9b4511cf66baf3d28f47 (diff) | |
download | CMake-5257af363442aa4168776b70db1fc58d218a20c8.zip CMake-5257af363442aa4168776b70db1fc58d218a20c8.tar.gz CMake-5257af363442aa4168776b70db1fc58d218a20c8.tar.bz2 |
cmMakefile: move common logic to IsProjectFile function
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d7c4f22..bbbe300 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1848,11 +1848,7 @@ void cmMakefile::LogUnused(const char* reason, const std::string& name) const path += "/CMakeLists.txt"; } - if (this->CheckSystemVars || - cmSystemTools::IsSubDirectory(path, this->GetHomeDirectory()) || - (cmSystemTools::IsSubDirectory(path, this->GetHomeOutputDirectory()) && - !cmSystemTools::IsSubDirectory(path, - cmake::GetCMakeFilesDirectory()))) { + if (this->CheckSystemVars || this->IsProjectFile(path.c_str())) { std::ostringstream msg; msg << "unused variable (" << reason << ") \'" << name << "\'"; this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); @@ -2702,6 +2698,14 @@ struct t_lookup size_t loc = 0; }; +bool cmMakefile::IsProjectFile(const char* filename) const +{ + return cmSystemTools::IsSubDirectory(filename, this->GetHomeDirectory()) || + (cmSystemTools::IsSubDirectory(filename, this->GetHomeOutputDirectory()) && + !cmSystemTools::IsSubDirectory(filename, + cmake::GetCMakeFilesDirectory())); +} + cmake::MessageType cmMakefile::ExpandVariablesInStringNew( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, @@ -2769,11 +2773,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( if (this->GetCMakeInstance()->GetWarnUninitialized() && !this->VariableInitialized(lookup)) { if (this->CheckSystemVars || - (filename && - (cmSystemTools::IsSubDirectory(filename, - this->GetHomeDirectory()) || - cmSystemTools::IsSubDirectory( - filename, this->GetHomeOutputDirectory())))) { + (filename && this->IsProjectFile(filename))) { std::ostringstream msg; msg << "uninitialized variable \'" << lookup << "\'"; this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); |