diff options
author | Fujii Hironori <fujii.hironori@gmail.com> | 2018-03-23 06:44:42 (GMT) |
---|---|---|
committer | Fujii Hironori <fujii.hironori@gmail.com> | 2018-04-23 04:31:28 (GMT) |
commit | f59c33a763ba1483129f0e721bc2394bb7442876 (patch) | |
tree | 3ff8c37758ffbe7faebe1e77ec9608e4d619775b /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | d58d4daa6b2e36c6e2318e4d67271542dca79ee6 (diff) | |
download | CMake-f59c33a763ba1483129f0e721bc2394bb7442876.zip CMake-f59c33a763ba1483129f0e721bc2394bb7442876.tar.gz CMake-f59c33a763ba1483129f0e721bc2394bb7442876.tar.bz2 |
VS: Generate a custom command only in the least dependent target
If a custom command is assigned to multiple targets, generate the build
rule only in the least-dependent `.vcxproj` file. Otherwise MSBuild
will run the command on the first build of a dependent target even if
its dependencies already brought the command up to date (in order to
populates its build log).
Generate targets in least-to-most-dependent order, and assign a custom
command to the least dependent target.
Added cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst to call
cmVisualStudio10TargetGenerator::Generate in least-dependent order.
Moved SourcesVisited from cmVisualStudio10TargetGenerator to
cmLocalVisualStudio10Generator to avoid attaching a custom command to
multiple targets among the local generator.
Fixes: #16767
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 625cb83..d27bec9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1178,7 +1178,6 @@ void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues( void cmVisualStudio10TargetGenerator::WriteCustomCommands() { - this->SourcesVisited.clear(); this->CSharpCustomCommandNames.clear(); std::vector<cmSourceFile const*> customCommands; this->GeneratorTarget->GetCustomCommands(customCommands, ""); @@ -1199,7 +1198,9 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands() void cmVisualStudio10TargetGenerator::WriteCustomCommand( cmSourceFile const* sf) { - if (this->SourcesVisited.insert(sf).second) { + if (this->LocalGenerator->GetSourcesVisited(this->GeneratorTarget) + .insert(sf) + .second) { if (std::vector<cmSourceFile*> const* depends = this->GeneratorTarget->GetSourceDepends(sf)) { for (cmSourceFile const* di : *depends) { |