From fcad8d0630036cde6e99ae600e101dbbd5646c96 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Mar 2023 10:17:16 -0500 Subject: cmMakefile: Improve parsing of CMAKE_MAXIMUM_RECURSION_DEPTH variable --- Source/cmMakefile.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 33843e2..a014776 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -455,12 +455,11 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, // Check for maximum recursion depth. int depth = CMake_DEFAULT_RECURSION_LIMIT; - cmValue depthStr = this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH"); - if (depthStr) { - std::istringstream s(*depthStr); - int d; - if (s >> d) { - depth = d; + if (cmValue depthStr = + this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH")) { + unsigned long depthUL; + if (cmStrToULong(depthStr.GetCStr(), &depthUL)) { + depth = static_cast(depthUL); } } if (this->RecursionDepth > depth) { -- cgit v0.12