Browse Source

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
Kevin Puetz 8 years ago
parent
commit
b554caf753
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Source/cmGlobalNinjaGenerator.cxx

+ 4 - 0
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 =