Files
CMake/Tests/RunCMake/Ninja/ShowIncludes-check.cmake
T
Brad King 2e5af30ce0 Ninja: Match showIncludes dependencies using console output code page
Generalize the fix from commit 37a279f8d1 (Ninja: Write msvc_deps_prefix
as UTF-8 when console codepage is UTF-8, 2020-07-31, v3.19.0-rc1~349^2).
`cl /showIncludes` output is encoded using the console output code page,
so this is the byte sequence that Ninja must use to match its lines.

Fixes: #24068
2022-10-30 08:29:55 -04:00

18 lines
589 B
CMake

set(rules_ninja "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/rules.ninja")
if(NOT EXISTS "${rules_ninja}")
set(RunCMake_TEST_FAILED "Generator output file is missing:\n ${rules_ninja}")
return()
endif()
file(READ "${rules_ninja}" rules_ninja)
if(rules_ninja MATCHES "msvc_deps_prefix = ([^\r\n]*)\n")
set(actual "${CMAKE_MATCH_1}")
endif()
if(NOT actual STREQUAL expect)
string(HEX "${actual}" actual_hex)
string(HEX "${expect}" expect_hex)
set(RunCMake_TEST_FAILED "Expected byte sequence\n '${expect}' (${expect_hex})\nbut got\n '${actual}' (${actual_hex})")
return()
endif()