summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileUtilityTargetGenerator.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2007-03-02 19:31:04 (GMT)
committerKen Martin <ken.martin@kitware.com>2007-03-02 19:31:04 (GMT)
commit1de68b46f1650735bcc550626436f5286ccf36c2 (patch)
treef2529f26955d6abe9c48ac21cbb89962098eeda6 /Source/cmMakefileUtilityTargetGenerator.cxx
parentb9ab2b1932b08fb98308de6b271fcbca3ce313e2 (diff)
downloadCMake-1de68b46f1650735bcc550626436f5286ccf36c2.zip
CMake-1de68b46f1650735bcc550626436f5286ccf36c2.tar.gz
CMake-1de68b46f1650735bcc550626436f5286ccf36c2.tar.bz2
BUG: fix for build order
Diffstat (limited to 'Source/cmMakefileUtilityTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx29
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 6ab1863..6040023 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -23,6 +23,12 @@
#include "cmSourceFile.h"
#include "cmTarget.h"
+//----------------------------------------------------------------------------
+cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator()
+{
+ this->DriveCustomCommandsOnDepends = true;
+}
+
//----------------------------------------------------------------------------
void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
@@ -42,10 +48,30 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
// Utility targets store their rules in pre- and post-build commands.
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->LocalGenerator->AppendCustomCommands
(commands, this->Target->GetPostBuildCommands());
@@ -53,8 +79,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
this->AppendTargetDepends(depends);
// Add a dependency on the rule file itself.
- std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
- std::string objTarget = relPath;
+ objTarget = relPath;
objTarget += this->BuildFileName;
this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str());