mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user