From 497f7d5c1af04f6c7120bcec40af9a1fee938883 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Mar 2023 10:26:51 -0500 Subject: Tests: Simplify option passing to RunCMake.MaxRecursionDepth cases --- .../RunCMake/MaxRecursionDepth/RunCMakeTest.cmake | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake b/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake index c5a859d..f379eba 100644 --- a/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake +++ b/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake @@ -2,17 +2,11 @@ include(RunCMake) include(RunCTest) function(run_cmake_recursive name) - set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) - run_cmake(${name}-default) - unset(RunCMake_TEST_OPTIONS) - set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) - run_cmake(${name}-var) - unset(RunCMake_TEST_OPTIONS) - set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a) - run_cmake(${name}-invalid-var) - unset(RunCMake_TEST_OPTIONS) - + run_cmake_with_options(${name}-default "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) run_cmake_command(${name}-default-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") + + run_cmake_with_options(${name}-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) + run_cmake_with_options(${name}-invalid-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a) run_cmake_command(${name}-var-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10 -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") run_cmake_command(${name}-invalid-var-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") endfunction() @@ -32,12 +26,8 @@ run_cmake_recursive(variable_watch) # We run these tests separately and only with a small limit because they are # taxing and slow. The "implicit" and "invalid" cases are already thoroughly # covered by the other tests above. -set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=add_subdirectory -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) -run_cmake(add_subdirectory-var) -unset(RunCMake_TEST_OPTIONS) -set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=try_compile -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) -run_cmake(try_compile-var) -unset(RunCMake_TEST_OPTIONS) +run_cmake_with_options(add_subdirectory-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=add_subdirectory -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) +run_cmake_with_options(try_compile-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=try_compile -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) run_ctest_recursive(ctest_read_custom_files) -- cgit v0.12 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 From 88bc8dfc14f02ee07654c906a0e6be5d5a33b017 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Mar 2023 11:32:03 -0400 Subject: cmMakefile: Store recursion depth limit as size_t --- Source/cmGlobalGenerator.cxx | 2 -- Source/cmGlobalGenerator.h | 2 +- Source/cmMakefile.cxx | 9 ++++----- Source/cmMakefile.h | 6 +++--- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 72eed69..7ed68d6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -110,8 +110,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->ConfigureDoneCMP0026AndCMP0024 = false; this->FirstTimeProgress = 0.0f; - this->RecursionDepth = 0; - cm->GetState()->SetIsGeneratorMultiConfig(false); cm->GetState()->SetMinGWMake(false); cm->GetState()->SetMSYSShell(false); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 66ab752..7de8215 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -586,7 +586,7 @@ public: std::string MakeSilentFlag; - int RecursionDepth; + size_t RecursionDepth = 0; virtual void GetQtAutoGenConfigs(std::vector& configs) const { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a014776..d0a8958 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -99,7 +99,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, this->StateSnapshot = this->StateSnapshot.GetState()->CreatePolicyScopeSnapshot( this->StateSnapshot); - this->RecursionDepth = 0; // Enter a policy level for this directory. this->PushPolicy(); @@ -454,12 +453,12 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, static_cast(stack_manager); // Check for maximum recursion depth. - int depth = CMake_DEFAULT_RECURSION_LIMIT; + 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 = static_cast(depthUL); + depth = depthUL; } } if (this->RecursionDepth > depth) { @@ -2864,12 +2863,12 @@ bool cmMakefile::IsProjectFile(const char* filename) const !cmSystemTools::IsSubDirectory(filename, "/CMakeFiles")); } -int cmMakefile::GetRecursionDepth() const +size_t cmMakefile::GetRecursionDepth() const { return this->RecursionDepth; } -void cmMakefile::SetRecursionDepth(int recursionDepth) +void cmMakefile::SetRecursionDepth(size_t recursionDepth) { this->RecursionDepth = recursionDepth; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6f04937..6923a77 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1023,8 +1023,8 @@ public: const char* sourceFilename) const; bool IsProjectFile(const char* filename) const; - int GetRecursionDepth() const; - void SetRecursionDepth(int recursionDepth); + size_t GetRecursionDepth() const; + void SetRecursionDepth(size_t recursionDepth); std::string NewDeferId() const; bool DeferCall(std::string id, std::string fileName, cmListFileFunction lff); @@ -1090,7 +1090,7 @@ protected: private: cmStateSnapshot StateSnapshot; cmListFileBacktrace Backtrace; - int RecursionDepth; + size_t RecursionDepth = 0; struct DeferCommand { -- cgit v0.12 From 395895bda72462c59e18135e98662e47f52138ba Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Mar 2023 11:20:21 -0400 Subject: cmMakefile: Factor out helper to get recursion depth limit --- Source/cmMakefile.cxx | 26 ++++++++++++++++---------- Source/cmMakefile.h | 2 ++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d0a8958..383a818 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -453,17 +453,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, static_cast(stack_manager); // Check for maximum recursion depth. - 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; - } - } - if (this->RecursionDepth > depth) { + size_t depthLimit = this->GetRecursionDepthLimit(); + if (this->RecursionDepth > depthLimit) { std::ostringstream e; - e << "Maximum recursion depth of " << depth << " exceeded"; + e << "Maximum recursion depth of " << depthLimit << " exceeded"; this->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccurred(); return false; @@ -2863,6 +2856,19 @@ bool cmMakefile::IsProjectFile(const char* filename) const !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 { return this->RecursionDepth; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6923a77..a43ff41 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1023,6 +1023,8 @@ public: const char* sourceFilename) const; bool IsProjectFile(const char* filename) const; + size_t GetRecursionDepthLimit() const; + size_t GetRecursionDepth() const; void SetRecursionDepth(size_t recursionDepth); -- cgit v0.12 From 89b69bf1addad6138b9aa51c2f67380c9e489f2f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Mar 2023 10:17:16 -0500 Subject: Add CMAKE_MAXIMUM_RECURSION_DEPTH environment variable Extend the recursion limit controls added by commit a6982cff0d (cmMakefile: Impose maximum recursion limit, 2018-12-14, v3.14.0-rc1~82^2) with an environment variable that is used if the CMake variable of the same name is not set. --- Help/envvar/CMAKE_MAXIMUM_RECURSION_DEPTH.rst | 10 +++++++ Help/manual/cmake-env-variables.7.rst | 1 + Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst | 2 ++ Source/cmMakefile.cxx | 6 ++++ .../RunCMake/MaxRecursionDepth/RunCMakeTest.cmake | 22 ++++++++++++++ .../ctest_read_custom_files-env-result.txt | 1 + .../ctest_read_custom_files-env-stderr.txt | 34 ++++++++++++++++++++++ .../ctest_read_custom_files-invalid-env-result.txt | 1 + .../ctest_read_custom_files-invalid-env-stderr.txt | 5 ++++ .../MaxRecursionDepth/find_package-env-result.txt | 1 + .../find_package-env-script-result.txt | 1 + .../find_package-env-script-stderr.txt | 21 +++++++++++++ .../MaxRecursionDepth/find_package-env-stderr.txt | 21 +++++++++++++ .../find_package-invalid-env-result.txt | 1 + .../find_package-invalid-env-script-result.txt | 1 + .../find_package-invalid-env-script-stderr.txt | 5 ++++ .../find_package-invalid-env-stderr.txt | 5 ++++ .../MaxRecursionDepth/function-env-result.txt | 1 + .../function-env-script-result.txt | 1 + .../function-env-script-stderr.txt | 21 +++++++++++++ .../MaxRecursionDepth/function-env-stderr.txt | 21 +++++++++++++ .../function-invalid-env-result.txt | 1 + .../function-invalid-env-script-result.txt | 1 + .../function-invalid-env-script-stderr.txt | 5 ++++ .../function-invalid-env-stderr.txt | 5 ++++ .../MaxRecursionDepth/include-env-result.txt | 1 + .../include-env-script-result.txt | 1 + .../include-env-script-stderr.txt | 21 +++++++++++++ .../MaxRecursionDepth/include-env-stderr.txt | 21 +++++++++++++ .../include-invalid-env-result.txt | 1 + .../include-invalid-env-script-result.txt | 1 + .../include-invalid-env-script-stderr.txt | 5 ++++ .../include-invalid-env-stderr.txt | 5 ++++ .../MaxRecursionDepth/macro-env-result.txt | 1 + .../MaxRecursionDepth/macro-env-script-result.txt | 1 + .../MaxRecursionDepth/macro-env-script-stderr.txt | 21 +++++++++++++ .../MaxRecursionDepth/macro-env-stderr.txt | 21 +++++++++++++ .../MaxRecursionDepth/macro-invalid-env-result.txt | 1 + .../macro-invalid-env-script-result.txt | 1 + .../macro-invalid-env-script-stderr.txt | 5 ++++ .../MaxRecursionDepth/macro-invalid-env-stderr.txt | 5 ++++ .../variable_watch-env-result.txt | 1 + .../variable_watch-env-script-result.txt | 1 + .../variable_watch-env-script-stderr.txt | 22 ++++++++++++++ .../variable_watch-env-stderr.txt | 22 ++++++++++++++ .../variable_watch-invalid-env-result.txt | 1 + .../variable_watch-invalid-env-script-result.txt | 1 + .../variable_watch-invalid-env-script-stderr.txt | 6 ++++ .../variable_watch-invalid-env-stderr.txt | 6 ++++ 49 files changed, 366 insertions(+) create mode 100644 Help/envvar/CMAKE_MAXIMUM_RECURSION_DEPTH.rst create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-invalid-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-invalid-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-invalid-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-invalid-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-env-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-result.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-stderr.txt diff --git a/Help/envvar/CMAKE_MAXIMUM_RECURSION_DEPTH.rst b/Help/envvar/CMAKE_MAXIMUM_RECURSION_DEPTH.rst new file mode 100644 index 0000000..2d65b60 --- /dev/null +++ b/Help/envvar/CMAKE_MAXIMUM_RECURSION_DEPTH.rst @@ -0,0 +1,10 @@ +CMAKE_MAXIMUM_RECURSION_DEPTH +----------------------------- + +.. versionadded:: 3.27 + +.. include:: ENV_VAR.txt + +Maximum recursion depth for CMake scripts. This environment variable is +used if the :variable:`CMAKE_MAXIMUM_RECURSION_DEPTH` variable is not set. +See that variable's documentation for details. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 4c29b80..1f0c911 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -20,6 +20,7 @@ Environment Variables that Change Behavior .. toctree:: :maxdepth: 1 + /envvar/CMAKE_MAXIMUM_RECURSION_DEPTH /envvar/CMAKE_PREFIX_PATH /envvar/SSL_CERT_DIR /envvar/SSL_CERT_FILE diff --git a/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst b/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst index 59c60d3..b611967 100644 --- a/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst +++ b/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst @@ -33,3 +33,5 @@ Calling any of the following commands increases the recursion depth: depth) * Reading or writing variables that are being watched by a :command:`variable_watch` + +See also the :envvar:`CMAKE_MAXIMUM_RECURSION_DEPTH` environment variable. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 383a818..638da06 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2865,6 +2865,12 @@ size_t cmMakefile::GetRecursionDepthLimit() const if (cmStrToULong(depthStr.GetCStr(), &depthUL)) { depth = depthUL; } + } else if (cm::optional depthEnv = + cmSystemTools::GetEnvVar("CMAKE_MAXIMUM_RECURSION_DEPTH")) { + unsigned long depthUL; + if (cmStrToULong(*depthEnv, &depthUL)) { + depth = depthUL; + } } return depth; } diff --git a/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake b/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake index f379eba..fdf418f 100644 --- a/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake +++ b/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake @@ -1,20 +1,42 @@ include(RunCMake) include(RunCTest) +# Isolate this test from the caller's environment. +unset(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH}) + function(run_cmake_recursive name) run_cmake_with_options(${name}-default "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) run_cmake_command(${name}-default-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") + set(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH} 5) # overridden, not used run_cmake_with_options(${name}-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) run_cmake_with_options(${name}-invalid-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a) run_cmake_command(${name}-var-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10 -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") run_cmake_command(${name}-invalid-var-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") + + set(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH} 10) + run_cmake_with_options(${name}-env "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) + run_cmake_command(${name}-env-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") + + set(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH} a) + run_cmake_with_options(${name}-invalid-env "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) + run_cmake_command(${name}-invalid-env-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") + + unset(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH}) endfunction() function(run_ctest_recursive name) run_ctest(${name}-default "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) run_ctest(${name}-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) run_ctest(${name}-invalid-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a) + + set(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH} 10) + run_ctest(${name}-env "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) + + set(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH} a) + run_ctest(${name}-invalid-env "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) + + unset(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH}) endfunction() run_cmake_recursive(function) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt new file mode 100644 index 0000000..b664fa0 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env-stderr.txt @@ -0,0 +1,34 @@ +^2 +3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-env/test\.cmake:10 \(ctest_read_custom_files\) + + +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake$ diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-stderr.txt new file mode 100644 index 0000000..7dbbb3e --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-env-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-env-script-stderr.txt new file mode 100644 index 0000000..5314551 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-env-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/find_package\.cmake:2 \(find_package\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-env-stderr.txt new file mode 100644 index 0000000..b47a13a --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-env-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + find_package\.cmake:2 \(find_package\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt new file mode 100644 index 0000000..b8557ab --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/FindRecursivePackage\.cmake:3 \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt new file mode 100644 index 0000000..5d31e29 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + FindRecursivePackage\.cmake:3 \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/function-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-env-script-stderr.txt new file mode 100644 index 0000000..61304b1 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-env-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/function\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:7 \(recursive\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/function-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-env-stderr.txt new file mode 100644 index 0000000..54e72af --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-env-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at function\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:7 \(recursive\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-stderr.txt new file mode 100644 index 0000000..92de1fb --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/function\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/function\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-stderr.txt new file mode 100644 index 0000000..5c25c4b --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-env-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at function\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + function\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/include-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-env-script-stderr.txt new file mode 100644 index 0000000..f55f505 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-env-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/include_recursive\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include\.cmake:2 \(include\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/include-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-env-stderr.txt new file mode 100644 index 0000000..ff33985 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-env-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at include_recursive\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include\.cmake:2 \(include\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-stderr.txt new file mode 100644 index 0000000..0510e7c --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/include_recursive\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/include_recursive\.cmake:3 \(include\) diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-stderr.txt new file mode 100644 index 0000000..b1494a8 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-env-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at include_recursive\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + include_recursive\.cmake:3 \(include\) diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-env-script-stderr.txt new file mode 100644 index 0000000..142e068 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-env-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/macro\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:7 \(recursive\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-env-stderr.txt new file mode 100644 index 0000000..71de553 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-env-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at macro\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:7 \(recursive\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-stderr.txt new file mode 100644 index 0000000..c67be57 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/macro\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/macro\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-stderr.txt new file mode 100644 index 0000000..0b27162 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-env-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at macro\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + macro\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-stderr.txt new file mode 100644 index 0000000..52fedd3 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-script-stderr.txt @@ -0,0 +1,22 @@ +^4 +6 +8 +10 +CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) + .*/variable_watch\.cmake:9 \(set\) + .*/CMakeLists\.txt:5 \(include\) + + +CMake Error: Error in cmake code at +Unknown:0: +A command failed during the invocation of callback "update_x"\.$ diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-stderr.txt new file mode 100644 index 0000000..1427f1d --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-env-stderr.txt @@ -0,0 +1,22 @@ +^4 +6 +8 +10 +CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:[0-9]+ \(update_x\) + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:[0-9]+ \(update_x\) + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:[0-9]+ \(update_x\) + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:[0-9]+ \(update_x\) + variable_watch\.cmake:9 \(set\) + CMakeLists\.txt:5 \(include\) + + +CMake Error: Error in cmake code at +Unknown:0: +A command failed during the invocation of callback "update_x"\.$ diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-stderr.txt new file mode 100644 index 0000000..07deee2 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-script-stderr.txt @@ -0,0 +1,6 @@ +[0-9]+ +CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-stderr.txt new file mode 100644 index 0000000..b2395b3 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-env-stderr.txt @@ -0,0 +1,6 @@ +[0-9]+ +CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:[0-9]+ \(update_x\) -- cgit v0.12 From 60ef076bacca9a265ab4ab68032933c464e84a66 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Mar 2023 11:07:55 -0400 Subject: find_package: Enforce maximum nesting depth below maximum recursion depth The stack usage for nested `find_package` calls is much larger than for other kinds of recursion, so enforce a lower limit to avoid stack overflow. --- Source/cmFindPackageCommand.cxx | 15 +++++++++++++++ .../find_package-default-script-stderr.txt | 8 +++++--- .../MaxRecursionDepth/find_package-default-stderr.txt | 6 +++--- .../find_package-invalid-env-script-stderr.txt | 8 +++++--- .../MaxRecursionDepth/find_package-invalid-env-stderr.txt | 6 +++--- .../find_package-invalid-var-script-stderr.txt | 8 +++++--- .../MaxRecursionDepth/find_package-invalid-var-stderr.txt | 6 +++--- 7 files changed, 39 insertions(+), 18 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 8acfe83..b1e65af 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -976,6 +976,21 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args) } } + // Limit package nesting depth well below the recursion depth limit because + // find_package nesting uses more stack space than normal recursion. + { + static std::size_t const findPackageDepthMinMax = 100; + std::size_t const findPackageDepthMax = std::max( + this->Makefile->GetRecursionDepthLimit() / 2, findPackageDepthMinMax); + std::size_t const findPackageDepth = + this->Makefile->FindPackageRootPathStack.size() + 1; + if (findPackageDepth > findPackageDepthMax) { + this->SetError(cmStrCat("maximum nesting depth of ", findPackageDepthMax, + " exceeded.")); + return false; + } + } + this->PushFindPackageRootPathStack(); this->SetModuleVariables(components, componentVarDefs); diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt index b8557ab..4e965e8 100644 --- a/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt @@ -1,5 +1,7 @@ [0-9]+ -CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): - Maximum recursion depth of [0-9]+ exceeded +CMake Error at [^ +]*/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake:[0-9]+ \(find_package\): + find_package maximum nesting depth of [0-9]+ exceeded. Call Stack \(most recent call first\): - .*/FindRecursivePackage\.cmake:3 \(find_package\) + [^ +]*/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake:[0-9]+ \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt index 5d31e29..0119953 100644 --- a/Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt @@ -1,5 +1,5 @@ [0-9]+ -CMake Error at FindRecursivePackage\.cmake:1 \(message\): - Maximum recursion depth of [0-9]+ exceeded +CMake Error at FindRecursivePackage.cmake:[0-9]+ \(find_package\): + find_package maximum nesting depth of [0-9]+ exceeded. Call Stack \(most recent call first\): - FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage.cmake:[0-9]+ \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt index b8557ab..4e965e8 100644 --- a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-script-stderr.txt @@ -1,5 +1,7 @@ [0-9]+ -CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): - Maximum recursion depth of [0-9]+ exceeded +CMake Error at [^ +]*/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake:[0-9]+ \(find_package\): + find_package maximum nesting depth of [0-9]+ exceeded. Call Stack \(most recent call first\): - .*/FindRecursivePackage\.cmake:3 \(find_package\) + [^ +]*/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake:[0-9]+ \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt index 5d31e29..0119953 100644 --- a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-env-stderr.txt @@ -1,5 +1,5 @@ [0-9]+ -CMake Error at FindRecursivePackage\.cmake:1 \(message\): - Maximum recursion depth of [0-9]+ exceeded +CMake Error at FindRecursivePackage.cmake:[0-9]+ \(find_package\): + find_package maximum nesting depth of [0-9]+ exceeded. Call Stack \(most recent call first\): - FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage.cmake:[0-9]+ \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt index b8557ab..4e965e8 100644 --- a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt @@ -1,5 +1,7 @@ [0-9]+ -CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): - Maximum recursion depth of [0-9]+ exceeded +CMake Error at [^ +]*/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake:[0-9]+ \(find_package\): + find_package maximum nesting depth of [0-9]+ exceeded. Call Stack \(most recent call first\): - .*/FindRecursivePackage\.cmake:3 \(find_package\) + [^ +]*/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake:[0-9]+ \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt index 5d31e29..0119953 100644 --- a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt @@ -1,5 +1,5 @@ [0-9]+ -CMake Error at FindRecursivePackage\.cmake:1 \(message\): - Maximum recursion depth of [0-9]+ exceeded +CMake Error at FindRecursivePackage.cmake:[0-9]+ \(find_package\): + find_package maximum nesting depth of [0-9]+ exceeded. Call Stack \(most recent call first\): - FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage.cmake:[0-9]+ \(find_package\) -- cgit v0.12 From 9504cef8c4d505f4f9fa66cbd485a2ac8b24ab72 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Mar 2023 11:06:58 -0500 Subject: Tests: Allow RunCMake.MaxRecursionDepth to test public-facing default limit Previously we compiled in a smaller default limit during nightly testing and CI builds, so we were not testing the same default limit that end-users will see. Instead, set the limit during testing using an environment variable so that we can unset it when testing the default limit in `RunCMake.MaxRecursionDepth`. --- Source/CMakeLists.txt | 4 +--- Tests/EnforceConfig.cmake.in | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 163dab3..a25329c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -12,9 +12,7 @@ endif() include(CheckIncludeFile) if(NOT CMake_DEFAULT_RECURSION_LIMIT) - if(DEFINED ENV{DASHBOARD_TEST_FROM_CTEST}) - set(CMake_DEFAULT_RECURSION_LIMIT 100) - elseif(MINGW OR MSYS) + if(MINGW OR MSYS) set(CMake_DEFAULT_RECURSION_LIMIT 400) elseif(WIN32 AND CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") set(CMake_DEFAULT_RECURSION_LIMIT 400) diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index 61be40b..a652efc 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -35,5 +35,8 @@ unset(ENV{CMAKE_GENERATOR_PLATFORM}) unset(ENV{CMAKE_GENERATOR_TOOLSET}) unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS}) +# Verify that our module implementations do not recurse too much. +set(ENV{CMAKE_MAXIMUM_RECURSION_DEPTH} 100) + @TEST_HOME_ENV_CODE@ @TEST_WARN_VS_CODE@ -- cgit v0.12 From 49167cf68fcfea201e4e81824baadf8bef413e4c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Mar 2023 10:39:34 -0500 Subject: Source: Adjust stack sizes and recursion limits to work together Adjust `CMake_DEFAULT_RECURSION_LIMIT` and/or the process stack size on each platform to pass the `RunCMake.MaxRecursionDepth` test's "default" cases. --- CompileFlags.cmake | 15 ++++++++------- Source/CMakeLists.txt | 12 ------------ Source/cmConfigure.cmake.h.in | 2 +- Source/cmMakefile.cxx | 18 ++++++++++++++++++ 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 6331af1..f94e079 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -8,7 +8,7 @@ if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel") set(_INTEL_WINDOWS 1) endif() -if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang" +if(WIN32 AND CMAKE_C_COMPILER_ID MATCHES "^(Clang|IntelLLVM)$" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(_CLANG_MSVC_WINDOWS 1) endif() @@ -22,18 +22,19 @@ if(MSVC OR _INTEL_WINDOWS OR _CLANG_MSVC_WINDOWS) else() endif() -if(MSVC) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CXX_LINKER_WRAPPER_FLAG}-stack:10000000") -endif() - # MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it. if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.28) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd5105") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105") endif() -if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000") +# Use a stack size large enough for CMake_DEFAULT_RECURSION_LIMIT. +if(MSVC) + string(APPEND CMAKE_EXE_LINKER_FLAGS " ${CMAKE_CXX_LINKER_WRAPPER_FLAG}-stack:10000000") +elseif(MINGW OR MSYS OR CYGWIN) + string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--stack,10000000") +elseif(_CLANG_MSVC_WINDOWS AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -Xlinker -stack:20000000") endif() #silence duplicate symbol warnings on AIX diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a25329c..33514ba 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -11,18 +11,6 @@ endif() include(CheckIncludeFile) -if(NOT CMake_DEFAULT_RECURSION_LIMIT) - if(MINGW OR MSYS) - set(CMake_DEFAULT_RECURSION_LIMIT 400) - elseif(WIN32 AND CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") - set(CMake_DEFAULT_RECURSION_LIMIT 400) - elseif(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM") - set(CMake_DEFAULT_RECURSION_LIMIT 600) - else() - set(CMake_DEFAULT_RECURSION_LIMIT 1000) - endif() -endif() - if(APPLE) set(CMake_USE_MACH_PARSER 1) endif() diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 90f3de0..3f19a11 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -23,7 +23,7 @@ #cmakedefine CMake_USE_MACH_PARSER #cmakedefine CMake_USE_XCOFF_PARSER #cmakedefine CMAKE_USE_WMAKE -#define CMake_DEFAULT_RECURSION_LIMIT @CMake_DEFAULT_RECURSION_LIMIT@ +#cmakedefine CMake_DEFAULT_RECURSION_LIMIT @CMake_DEFAULT_RECURSION_LIMIT@ #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" #define CMAKE_DOC_DIR "/@CMAKE_DOC_DIR@" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 638da06..f37268d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -67,6 +67,24 @@ # include "cmVariableWatch.h" #endif +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + +// Select a recursion limit that fits within the stack size. +// See stack size flags in '../CompileFlags.cmake'. +#ifndef CMake_DEFAULT_RECURSION_LIMIT +# if __has_feature(address_sanitizer) +# define CMake_DEFAULT_RECURSION_LIMIT 400 +# elif defined(_MSC_VER) && defined(_DEBUG) +# define CMake_DEFAULT_RECURSION_LIMIT 600 +# elif defined(__ibmxl__) && defined(__linux) +# define CMake_DEFAULT_RECURSION_LIMIT 600 +# else +# define CMake_DEFAULT_RECURSION_LIMIT 1000 +# endif +#endif + class cmMessenger; cmDirectoryId::cmDirectoryId(std::string s) -- cgit v0.12