diff options
author | Brad King <brad.king@kitware.com> | 2023-03-10 15:39:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-13 15:50:21 (GMT) |
commit | 49167cf68fcfea201e4e81824baadf8bef413e4c (patch) | |
tree | eebb5b15ad078945c18dae00e9083c4f5f893764 /Source | |
parent | 9504cef8c4d505f4f9fa66cbd485a2ac8b24ab72 (diff) | |
download | CMake-49167cf68fcfea201e4e81824baadf8bef413e4c.zip CMake-49167cf68fcfea201e4e81824baadf8bef413e4c.tar.gz CMake-49167cf68fcfea201e4e81824baadf8bef413e4c.tar.bz2 |
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.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Source/cmConfigure.cmake.h.in | 2 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 18 |
3 files changed, 19 insertions, 13 deletions
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) |