mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 14:23:10 -05:00
cmMakefile: move common logic to IsProjectFile function
This commit is contained in:
+10
-10
@@ -1848,11 +1848,7 @@ void cmMakefile::LogUnused(const char* reason, const std::string& name) const
|
|||||||
path += "/CMakeLists.txt";
|
path += "/CMakeLists.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->CheckSystemVars ||
|
if (this->CheckSystemVars || this->IsProjectFile(path.c_str())) {
|
||||||
cmSystemTools::IsSubDirectory(path, this->GetHomeDirectory()) ||
|
|
||||||
(cmSystemTools::IsSubDirectory(path, this->GetHomeOutputDirectory()) &&
|
|
||||||
!cmSystemTools::IsSubDirectory(path,
|
|
||||||
cmake::GetCMakeFilesDirectory()))) {
|
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "unused variable (" << reason << ") \'" << name << "\'";
|
msg << "unused variable (" << reason << ") \'" << name << "\'";
|
||||||
this->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
|
this->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
|
||||||
@@ -2702,6 +2698,14 @@ struct t_lookup
|
|||||||
size_t loc = 0;
|
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(
|
cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
|
||||||
std::string& errorstr, std::string& source, bool escapeQuotes,
|
std::string& errorstr, std::string& source, bool escapeQuotes,
|
||||||
bool noEscapes, bool atOnly, const char* filename, long line,
|
bool noEscapes, bool atOnly, const char* filename, long line,
|
||||||
@@ -2769,11 +2773,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
|
|||||||
if (this->GetCMakeInstance()->GetWarnUninitialized() &&
|
if (this->GetCMakeInstance()->GetWarnUninitialized() &&
|
||||||
!this->VariableInitialized(lookup)) {
|
!this->VariableInitialized(lookup)) {
|
||||||
if (this->CheckSystemVars ||
|
if (this->CheckSystemVars ||
|
||||||
(filename &&
|
(filename && this->IsProjectFile(filename))) {
|
||||||
(cmSystemTools::IsSubDirectory(filename,
|
|
||||||
this->GetHomeDirectory()) ||
|
|
||||||
cmSystemTools::IsSubDirectory(
|
|
||||||
filename, this->GetHomeOutputDirectory())))) {
|
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "uninitialized variable \'" << lookup << "\'";
|
msg << "uninitialized variable \'" << lookup << "\'";
|
||||||
this->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
|
this->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
|
||||||
|
|||||||
@@ -866,6 +866,7 @@ public:
|
|||||||
std::deque<std::vector<std::string>> FindPackageRootPathStack;
|
std::deque<std::vector<std::string>> FindPackageRootPathStack;
|
||||||
|
|
||||||
void MaybeWarnCMP0074(std::string const& pkg);
|
void MaybeWarnCMP0074(std::string const& pkg);
|
||||||
|
bool IsProjectFile(const char* filename) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// add link libraries and directories to the target
|
// add link libraries and directories to the target
|
||||||
|
|||||||
Reference in New Issue
Block a user