From b554caf75331ef8f185cdd8c7e7b5672acd8e6d7 Mon Sep 17 00:00:00 2001 From: Kevin Puetz Date: Fri, 28 Apr 2017 11:13:06 -0500 Subject: Ninja: List compile_commands.json as generated by CMake This fixes a false-positive `CMP0058` warning if any custom rules depend on `compile_commands.json` (e.g. to trigger rerunning clang-tooling utilities). Fixes: #16444 --- Source/cmGlobalNinjaGenerator.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index d9a8cab..88fcb12 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -898,6 +898,10 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( this->GetCMakeInstance()->GetHomeOutputDirectory(); if (!this->CompileCommandsStream) { std::string buildFilePath = buildFileDir + "/compile_commands.json"; + if (this->ComputingUnknownDependencies) { + this->CombinedBuildOutputs.insert( + this->NinjaOutputPath("compile_commands.json")); + } // Get a stream where to generate things. this->CompileCommandsStream = -- cgit v0.12