From ff119423b9527b1d69e57a7b0a84f687565dbf5c Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 18 Feb 2025 06:59:57 +0100 Subject: EXPORT_COMPILE_COMMANDS: Append missing newline to compile_commands.json --- Source/cmGlobalNinjaGenerator.cxx | 2 +- Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 5e90e06..ea1a122 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1236,7 +1236,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( void cmGlobalNinjaGenerator::CloseCompileCommandsStream() { if (this->CompileCommandsStream) { - *this->CompileCommandsStream << "\n]"; + *this->CompileCommandsStream << "\n]\n"; this->CompileCommandsStream.reset(); } } diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake index e65be3b..61a49a0 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake @@ -20,7 +20,8 @@ set(expected_compile_commands ]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)", "output": "(CMakeFiles/exe\.dir/Release/main\.c\.o|CMakeFiles\\\\exe\.dir\\\\Release\\\\main\.c\.(obj|o))" } -]$]==]) +] +$]==]) file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" actual_compile_commands) if(NOT actual_compile_commands MATCHES "${expected_compile_commands}") -- cgit v0.12