Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Pass the parent toolchain to CMake configuration tests

Commit
02f8b5593a15cdec8558256e6f40a0c7fb5862d6
Author
宁岑 ·
Committer
Martin Hořeňovský
Parents
889700e9799b

Files · Download .tar.gz

Changes

 tests/CMakeLists.txt                      | 5 +++++
 tests/TestScripts/ConfigureTestsCommon.py | 4 ++++
 2 files changed, 9 insertions(+)

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: