summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-01 08:05:17 -0400
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-01 08:05:17 -0400
commite02e56c4a6bbf4d98662d8faee27342b41f78e14 (patch)
tree3fcc1e2db63dc044a5d8c668e7dad9befeb7618f
parentfa97f43c81eac8379317a22d6d668984d2349fb0 (diff)
parentdccd4949c05dbabbbdbeb67be2e8d618157099d5 (diff)
downloadcmake-e02e56c4a6bbf4d98662d8faee27342b41f78e14.tar.gz
Merge topic 'fix-duplicate-custom-commands'
dccd494 Use first custom command for the same output (#14446)
-rw-r--r--Source/cmMakefile.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index fd06a33eae..34541e996c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1069,6 +1069,19 @@ void
cmMakefile::UpdateOutputToSourceMap(std::string const& output,
cmSourceFile* source)
{
+ OutputToSourceMap::iterator i = this->OutputToSource.find(output);
+ if(i != this->OutputToSource.end())
+ {
+ // Multiple custom commands produce the same output but may
+ // be attached to a different source file (MAIN_DEPENDENCY).
+ // LinearGetSourceFileWithOutput would return the first one,
+ // so keep the mapping for the first one.
+ //
+ // TODO: Warn the user about this case. However, the VS 8 generator
+ // triggers it for separate generate.stamp rules in ZERO_CHECK and
+ // individual targets.
+ return;
+ }
this->OutputToSource[output] = source;
}