Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
author宁岑2026-09-08 17:37:45 +0800
committerMartin Hořeňovský2026-09-14 14:08:28 +0200
commit02f8b5593a15cdec8558256e6f40a0c7fb5862d6 (patch)
tree708fb1c2cd05343f0b9008f733ad8ea7674df092
parent889700e9799becb812ebb2c0fcf3b888f975e0ea (diff)
downloadcatch3-02f8b5593a15cdec8558256e6f40a0c7fb5862d6.tar.gz
Pass the parent toolchain to CMake configuration tests
-rw-r--r--tests/CMakeLists.txt5
-rw-r--r--tests/TestScripts/ConfigureTestsCommon.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 469e3f3d..33daefb8 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -645,6 +645,11 @@ if(CATCH_ENABLE_CONFIGURE_TESTS)
COST 240
LABELS "uses-python"
)
+ if(CMAKE_TOOLCHAIN_FILE)
+ set_tests_properties("CMakeConfig::${testName}"
+ PROPERTIES ENVIRONMENT "CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
+ )
+ endif()
endforeach()
endif()
diff --git a/tests/TestScripts/ConfigureTestsCommon.py b/tests/TestScripts/ConfigureTestsCommon.py
index 66896a89..0af4c1f6 100644
--- a/tests/TestScripts/ConfigureTestsCommon.py
+++ b/tests/TestScripts/ConfigureTestsCommon.py
@@ -18,6 +18,10 @@ def configure_and_build(source_path: str, project_path: str, options: List[Tuple
'-S{}'.format(source_path),
'-DCMAKE_BUILD_TYPE=Debug',
'-DCATCH_DEVELOPMENT_BUILD=ON']
+ toolchain_file = os.environ.get('CMAKE_TOOLCHAIN_FILE')
+ if toolchain_file:
+ # CMake only reads this environment variable itself since 3.21.
+ base_configure_cmd.append('-DCMAKE_TOOLCHAIN_FILE={}'.format(toolchain_file))
for option, value in options:
base_configure_cmd.append('-D{}={}'.format(option, value))
try: