| 1 |
set(expected_compile_commands |
| 2 |
[==[^\[ |
| 3 |
{ |
| 4 |
"directory": "[^ |
| 5 |
]*/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build", |
| 6 |
"command": "[^ |
| 7 |
]*Debug[^ |
| 8 |
]*", |
| 9 |
"file": "[^ |
| 10 |
]*/Tests/RunCMake/NinjaMultiConfig/main\.c", |
| 11 |
"output": "[^ |
| 12 |
]*/CMakeFiles/exe\.dir/Debug/main\.c\.(obj|o)" |
| 13 |
}, |
| 14 |
{ |
| 15 |
"directory": "[^ |
| 16 |
]*/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build", |
| 17 |
"command": "[^ |
| 18 |
]*Release[^ |
| 19 |
]*", |
| 20 |
"file": "[^ |
| 21 |
]*/Tests/RunCMake/NinjaMultiConfig/main\.c", |
| 22 |
"output": "[^ |
| 23 |
]*/CMakeFiles/exe\.dir/Release/main\.c\.(obj|o)" |
| 24 |
} |
| 25 |
] |
| 26 |
$]==]) |
| 27 |
|
| 28 |
file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" actual_compile_commands) |
| 29 |
if(NOT actual_compile_commands MATCHES "${expected_compile_commands}") |
| 30 |
string(REPLACE "\n" "\n " expected_compile_commands_formatted "${expected_compile_commands}") |
| 31 |
string(REPLACE "\n" "\n " actual_compile_commands_formatted "${actual_compile_commands}") |
| 32 |
string(APPEND RunCMake_TEST_FAILED "Expected compile_commands.json to match:\n ${expected_compile_commands_formatted}\nActual compile_commands.json:\n ${actual_compile_commands_formatted}\n") |
| 33 |
endif() |