From 9504cef8c4d505f4f9fa66cbd485a2ac8b24ab72 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Mar 2023 11:06:58 -0500 Subject: [PATCH] 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 163dab3beb..a25329ce62 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 61be40b6a6..a652efcd0a 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@