summaryrefslogtreecommitdiff
path: root/Source/cmMakefileUtilityTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-05-01 13:51:25 -0400
committerBrad King <brad.king@kitware.com>2007-05-01 13:51:25 -0400
commitc51c245efa2cf6608e97862edbf7c1ba038e0cf2 (patch)
tree806b43b07962b817819f38590df63cfe1b96c81c /Source/cmMakefileUtilityTargetGenerator.cxx
parentef0b9ff2ccb1b40c23fb90d9feb36d261642eef1 (diff)
downloadcmake-c51c245efa2cf6608e97862edbf7c1ba038e0cf2.tar.gz
BUG: A utility target should not run the custom commands from its source files directly. The target-level rule must add dependencies on the file-level custom commands to drive them. This bug was introduced by the "fix" to bug 4377. This also restores the documented behavior that PRE_BUILD rules are treated as PRE_LINK rules on non-VS generators. Also fixed custom command dependencies on the rule file build.make so that custom commands re-run when the commands themselves change.
Diffstat (limited to 'Source/cmMakefileUtilityTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx28
1 files changed, 6 insertions, 22 deletions
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 60400239e7..c4ce9f114b 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -26,10 +26,9 @@
//----------------------------------------------------------------------------
cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator()
{
- this->DriveCustomCommandsOnDepends = true;
+ this->CustomCommandDriver = OnUtility;
}
-
//----------------------------------------------------------------------------
void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
{
@@ -49,39 +48,24 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
this->LocalGenerator->AppendCustomDepends
(depends, this->Target->GetPreBuildCommands());
- // Build list of dependencies.
- std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
- std::string objTarget;
-
this->LocalGenerator->AppendCustomDepends
(depends, this->Target->GetPostBuildCommands());
this->LocalGenerator->AppendCustomCommands
(commands, this->Target->GetPreBuildCommands());
-
+
// Depend on all custom command outputs for sources
- const std::vector<cmSourceFile*>& sources =
- this->Target->GetSourceFiles();
- for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
- source != sources.end(); ++source)
- {
- if(cmCustomCommand* cc = (*source)->GetCustomCommand())
- {
- this->LocalGenerator->AppendCustomCommand(commands, *cc);
- this->LocalGenerator->AppendCustomDepend(depends, *cc);
- }
- }
+ this->DriveCustomCommands(depends);
this->LocalGenerator->AppendCustomCommands
(commands, this->Target->GetPostBuildCommands());
// Add dependencies on targets that must be built first.
this->AppendTargetDepends(depends);
-
+
// Add a dependency on the rule file itself.
- objTarget = relPath;
- objTarget += this->BuildFileName;
- this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str());
+ this->LocalGenerator->AppendRuleDepend(depends,
+ this->BuildFileNameFull.c_str());
// If the rule is empty add the special empty rule dependency needed
// by some make tools.