From fa16b462f1ac2df9f14596657ae81efc2c934675 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 5 May 2021 09:45:01 -0400
Subject: [PATCH] Tests: Fix RunCMake.CMakePresets example PATH format

Since commit 94c955e508 (Tests: Test the CMakePresets.json example in
the documentation, 2020-10-09, v3.19.0-rc1~8^2) we transform the
documented preset example for testing by replacing the generator.
Extend the transformation with a step to fix `PATH` env var syntax.
---
 Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index 02051d916f..3b9806ab7e 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -316,6 +316,9 @@ run_cmake_presets(OptionalGeneratorField -G "${RunCMake_GENERATOR}")
 # Test the example from the documentation
 file(READ "${RunCMake_SOURCE_DIR}/../../../Help/manual/presets/example.json" _example)
 string(REPLACE "\"generator\": \"Ninja\"" "\"generator\": \"@RunCMake_GENERATOR@\"" _example "${_example}")
+if(CMAKE_HOST_WIN32)
+  string(REPLACE [["PATH": "$env{HOME}/ninja/bin:$penv{PATH}"]] [["PATH": "$env{HOME}/ninja/bin;$penv{PATH}"]] _example "${_example}")
+endif()
 file(WRITE "${RunCMake_BINARY_DIR}/example.json.in" "${_example}")
 set(CMakePresets_FILE "${RunCMake_BINARY_DIR}/example.json.in")
 run_cmake_presets(DocumentationExample --preset=default)
-- 
GitLab