cmMakefile: Factor out helper to get recursion depth limit
This commit is contained in:
parent
88bc8dfc14
commit
395895bda7
@ -453,17 +453,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
|
|||||||
static_cast<void>(stack_manager);
|
static_cast<void>(stack_manager);
|
||||||
|
|
||||||
// Check for maximum recursion depth.
|
// Check for maximum recursion depth.
|
||||||
size_t depth = CMake_DEFAULT_RECURSION_LIMIT;
|
size_t depthLimit = this->GetRecursionDepthLimit();
|
||||||
if (cmValue depthStr =
|
if (this->RecursionDepth > depthLimit) {
|
||||||
this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH")) {
|
|
||||||
unsigned long depthUL;
|
|
||||||
if (cmStrToULong(depthStr.GetCStr(), &depthUL)) {
|
|
||||||
depth = depthUL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->RecursionDepth > depth) {
|
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "Maximum recursion depth of " << depth << " exceeded";
|
e << "Maximum recursion depth of " << depthLimit << " exceeded";
|
||||||
this->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
this->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
||||||
cmSystemTools::SetFatalErrorOccurred();
|
cmSystemTools::SetFatalErrorOccurred();
|
||||||
return false;
|
return false;
|
||||||
@ -2863,6 +2856,19 @@ bool cmMakefile::IsProjectFile(const char* filename) const
|
|||||||
!cmSystemTools::IsSubDirectory(filename, "/CMakeFiles"));
|
!cmSystemTools::IsSubDirectory(filename, "/CMakeFiles"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t cmMakefile::GetRecursionDepthLimit() const
|
||||||
|
{
|
||||||
|
size_t depth = CMake_DEFAULT_RECURSION_LIMIT;
|
||||||
|
if (cmValue depthStr =
|
||||||
|
this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH")) {
|
||||||
|
unsigned long depthUL;
|
||||||
|
if (cmStrToULong(depthStr.GetCStr(), &depthUL)) {
|
||||||
|
depth = depthUL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return depth;
|
||||||
|
}
|
||||||
|
|
||||||
size_t cmMakefile::GetRecursionDepth() const
|
size_t cmMakefile::GetRecursionDepth() const
|
||||||
{
|
{
|
||||||
return this->RecursionDepth;
|
return this->RecursionDepth;
|
||||||
|
@ -1023,6 +1023,8 @@ public:
|
|||||||
const char* sourceFilename) const;
|
const char* sourceFilename) const;
|
||||||
bool IsProjectFile(const char* filename) const;
|
bool IsProjectFile(const char* filename) const;
|
||||||
|
|
||||||
|
size_t GetRecursionDepthLimit() const;
|
||||||
|
|
||||||
size_t GetRecursionDepth() const;
|
size_t GetRecursionDepth() const;
|
||||||
void SetRecursionDepth(size_t recursionDepth);
|
void SetRecursionDepth(size_t recursionDepth);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user