summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-03 19:44:07 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-08 18:52:22 (GMT)
commit066f4d0f0a324f0db810cde38904996bb16592cb (patch)
tree08247c4a8d70ba06a4ae9766a96c4f1ec5688e7f /Source/cmLocalVisualStudio7Generator.cxx
parent8bb5c96bf8bc363afa5da09ce1979614565d31ba (diff)
downloadCMake-066f4d0f0a324f0db810cde38904996bb16592cb.zip
CMake-066f4d0f0a324f0db810cde38904996bb16592cb.tar.gz
CMake-066f4d0f0a324f0db810cde38904996bb16592cb.tar.bz2
VS: Avoid unnecessary duplication of custom commands across targets in VS 9
Do not attach a custom command to a target if it is already attached to one of the target's dependencies. The command's output will be available by the time the target needs it because the dependency containing the command will have already been built. The same change was already made by commit f59c33a763 (VS: Generate a custom command only in the least dependent target, 2018-03-23, v3.12.0-rc1~171^2) for VS 10+.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 362c3e7..7795654 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1624,6 +1624,8 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
this->WriteVCProjBeginGroup(fout, name.c_str(), "");
}
+ auto& sourcesVisited = this->GetSourcesVisited(target);
+
// Loop through each source in the source group.
for (const cmSourceFile* sf : sourceFiles) {
std::string source = sf->GetFullPath();
@@ -1647,7 +1649,10 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
// build it, then it will.
fout << "\t\t\t\tRelativePath=\"" << d << "\">\n";
if (cmCustomCommand const* command = sf->GetCustomCommand()) {
- this->WriteCustomRule(fout, configs, source.c_str(), *command, fcinfo);
+ if (sourcesVisited.insert(sf).second) {
+ this->WriteCustomRule(fout, configs, source.c_str(), *command,
+ fcinfo);
+ }
} else if (!fcinfo.FileConfigMap.empty()) {
const char* aCompilerTool = "VCCLCompilerTool";
std::string ppLang = "CXX";