[cmake-developers] [CMake 0013559]: Ninja: Wrong dependency with PCH support

Peter Kümmel syntheticpp at gmx.net
Tue Sep 25 09:22:43 EDT 2012


On 25.09.2012 14:53, Mantis Bug Tracker wrote:
>
> The following issue has been SUBMITTED.
> ======================================================================
> http://public.kitware.com/Bug/view.php?id=13559
> ======================================================================

There is the code below in the ninja generator, which doesn't use "real"
but "order-only" dependency
(order-only dependency: "build when needed, don't rebuild on changes"
http://martine.github.com/ninja/manual.html#ref_dependencies)

Isn't this wrong at all?


   // Ensure that the target dependencies are built before any source file in
   // the target, using order-only dependencies.
   cmNinjaDeps orderOnlyDeps;
   this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps);

   if(const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) {
     std::vector<std::string> depList;
     cmSystemTools::ExpandListArgument(objectDeps, depList);
     std::transform(depList.begin(), depList.end(),
                    std::back_inserter(orderOnlyDeps), MapToNinjaPath());
   }

   // Add order-only dependencies on custom command outputs.
   for(std::vector<cmSourceFile*>::const_iterator
         si = this->GeneratorTarget->CustomCommands.begin();
       si != this->GeneratorTarget->CustomCommands.end(); ++si)
     {
     cmCustomCommand const* cc = (*si)->GetCustomCommand();
     const std::vector<std::string>& ccoutputs = cc->GetOutputs();
     std::transform(ccoutputs.begin(), ccoutputs.end(),
                    std::back_inserter(orderOnlyDeps), MapToNinjaPath());
     }

   // If the source file is GENERATED and does not have a custom command
   // (either attached to this source file or another one), assume that one of
   // the target dependencies, OBJECT_DEPENDS or header file custom commands
   // will rebuild the file.
   if (source->GetPropertyAsBool("GENERATED") && !source->GetCustomCommand() &&
       !this->GetGlobalGenerator()->HasCustomCommandOutput(sourceFileName)) {
     this->GetGlobalGenerator()->AddAssumedSourceDependencies(sourceFileName,
                                                              orderOnlyDeps);







More information about the cmake-developers mailing list