From c895d9f2e0dac609a8e3e126cc05a0400e9740a9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Feb 2009 08:50:33 -0500 Subject: ENH: Give target in which custom commands build This gives the cmTarget instance for which custom command rules are being generated to cmLocalUnixMakefileGenerator3::AppendCustomCommands. It will be useful in the future. --- Source/cmLocalUnixMakefileGenerator3.cxx | 10 ++++++++-- Source/cmLocalUnixMakefileGenerator3.h | 2 ++ Source/cmMakefileExecutableTargetGenerator.cxx | 9 ++++++--- Source/cmMakefileLibraryTargetGenerator.cxx | 9 ++++++--- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmMakefileUtilityTargetGenerator.cxx | 4 ++-- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3148d37..099ea98 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -954,12 +954,13 @@ void cmLocalUnixMakefileGenerator3 ::AppendCustomCommands(std::vector& commands, const std::vector& ccs, + cmTarget* target, cmLocalGenerator::RelativeRoot relative) { for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - this->AppendCustomCommand(commands, *i, true, relative); + this->AppendCustomCommand(commands, *i, target, true, relative); } } @@ -967,10 +968,13 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::AppendCustomCommand(std::vector& commands, - const cmCustomCommand& cc, bool echo_comment, + const cmCustomCommand& cc, + cmTarget* target, + bool echo_comment, cmLocalGenerator::RelativeRoot relative, std::ostream* content) { + static_cast(target); // Future use // Optionally create a command to display the custom command's // comment text. This is used for pre-build, pre-link, and // post-build command comments. Custom build step commands have @@ -1621,9 +1625,11 @@ void cmLocalUnixMakefileGenerator3 glIt->second.GetPostBuildCommands()); this->AppendCustomCommands(commands, glIt->second.GetPreBuildCommands(), + &glIt->second, cmLocalGenerator::START_OUTPUT); this->AppendCustomCommands(commands, glIt->second.GetPostBuildCommands(), + &glIt->second, cmLocalGenerator::START_OUTPUT); std::string targetName = glIt->second.GetName(); this->WriteMakeRule(ruleFileStream, targetString.c_str(), diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 0fdb593..3025078 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -326,10 +326,12 @@ protected: const cmCustomCommand& cc); void AppendCustomCommands(std::vector& commands, const std::vector& ccs, + cmTarget* target, cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::HOME_OUTPUT); void AppendCustomCommand(std::vector& commands, const cmCustomCommand& cc, + cmTarget* target, bool echo_comment=false, cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::HOME_OUTPUT, diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 9477ebf..6a75902 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -299,9 +299,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) if(!relink) { this->LocalGenerator - ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands()); + ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), + this->Target); this->LocalGenerator - ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands()); + ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), + this->Target); } // Determine whether a link script will be used. @@ -436,7 +438,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) if(!relink) { this->LocalGenerator-> - AppendCustomCommands(commands, this->Target->GetPostBuildCommands()); + AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), + this->Target); } // Write the build rule. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index a67b44a..7e5edc4 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -600,9 +600,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules if(!relink) { this->LocalGenerator - ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands()); + ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), + this->Target); this->LocalGenerator - ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands()); + ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), + this->Target); } // Determine whether a link script will be used. @@ -867,7 +869,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules if(!relink) { this->LocalGenerator-> - AppendCustomCommands(commands, this->Target->GetPostBuildCommands()); + AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), + this->Target); } // Write the build rule. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 4e71b2c..6bc5bd2 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1125,7 +1125,7 @@ void cmMakefileTargetGenerator // Now append the actual user-specified commands. cmOStringStream content; - this->LocalGenerator->AppendCustomCommand(commands, cc, false, + this->LocalGenerator->AppendCustomCommand(commands, cc, this->Target, false, cmLocalGenerator::HOME_OUTPUT, &content); diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index da9ca0d..ab9d875 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -54,13 +54,13 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() (depends, this->Target->GetPostBuildCommands()); this->LocalGenerator->AppendCustomCommands - (commands, this->Target->GetPreBuildCommands()); + (commands, this->Target->GetPreBuildCommands(), this->Target); // Depend on all custom command outputs for sources this->DriveCustomCommands(depends); this->LocalGenerator->AppendCustomCommands - (commands, this->Target->GetPostBuildCommands()); + (commands, this->Target->GetPostBuildCommands(), this->Target); // Add dependencies on targets that must be built first. this->AppendTargetDepends(depends); -- cgit v0.12