diff options
author | Brad King <brad.king@kitware.com> | 2015-11-19 20:13:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-11-19 20:47:41 (GMT) |
commit | 3477b26ff6c455b64421bf19000d7203acdd6024 (patch) | |
tree | 91bcf0bb910e3cf1621481b5d88e20db13c8d1d1 /Source/cmLocalNinjaGenerator.cxx | |
parent | 7d64a0598db5da2c4c1874f9fe8726fd6c9b18a7 (diff) | |
download | CMake-3477b26ff6c455b64421bf19000d7203acdd6024.zip CMake-3477b26ff6c455b64421bf19000d7203acdd6024.tar.gz CMake-3477b26ff6c455b64421bf19000d7203acdd6024.tar.bz2 |
Ninja: Always re-run custom commands that have symbolic dependencies
If a custom command has a SYMBOLIC output (that is never actually
created) then do not mark the custom command build statement as
'restat'. Otherwise other custom commands that depend on the symbolic
output may not always re-run because after running the first custom
command Ninja 'restat' will detect that the output timestamp did not
change and skip its dependents.
This was observed with the ExternalProject BUILD_ALWAYS option where
Ninja would not re-run the 'install' step each time 'build' re-runs.
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index d9517d8..b2927a9 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -398,6 +398,16 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( const std::vector<std::string> &byproducts = ccg.GetByproducts(); cmNinjaDeps ninjaOutputs(outputs.size()+byproducts.size()), ninjaDeps; + bool symbolic = false; + for (std::vector<std::string>::const_iterator o = outputs.begin(); + o != outputs.end(); ++o) + { + if (cmSourceFile* sf = this->Makefile->GetSource(*o)) + { + symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } + } + #if 0 #error TODO: Once CC in an ExternalProject target must provide the \ file of each imported target that has an add_dependencies pointing \ @@ -434,7 +444,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0], cc->GetUsesTerminal(), - /*restat*/true, + /*restat*/!symbolic, ninjaOutputs, ninjaDeps, orderOnlyDeps); |