summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-02-10 13:51:15 (GMT)
committerBrad King <brad.king@kitware.com>2009-02-10 13:51:15 (GMT)
commitb604b98c5690c49109ad464190c1b8a7562410b0 (patch)
treed477ac9d52d7328848deb4e460628deb775a29fd /Source/cmLocalUnixMakefileGenerator3.cxx
parentc895d9f2e0dac609a8e3e126cc05a0400e9740a9 (diff)
downloadCMake-b604b98c5690c49109ad464190c1b8a7562410b0.zip
CMake-b604b98c5690c49109ad464190c1b8a7562410b0.tar.gz
CMake-b604b98c5690c49109ad464190c1b8a7562410b0.tar.bz2
ENH: Define RULE_LAUNCH_* properties
This defines global, directory, and target properties RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK, and RULE_LAUNCH_CUSTOM. Their values specify 'launcher' command lines which are prefixed to compile, link, and custom build rules by Makefile generators.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx37
1 files changed, 34 insertions, 3 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 099ea98..3910bc1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -974,7 +974,6 @@ cmLocalUnixMakefileGenerator3
cmLocalGenerator::RelativeRoot relative,
std::ostream* content)
{
- static_cast<void>(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
@@ -1043,7 +1042,9 @@ cmLocalUnixMakefileGenerator3
cmd = scmd;
}
}
- cmd = this->Convert(cmd.c_str(),NONE,SHELL);
+ std::string launcher =
+ this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT);
+ cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL);
for(unsigned int j=1; j < commandLine.size(); ++j)
{
cmd += " ";
@@ -1059,7 +1060,8 @@ cmLocalUnixMakefileGenerator3
}
if(content)
{
- *content << cmd;
+ // Rule content does not include the launcher.
+ *content << (cmd.c_str()+launcher.size());
}
if(this->BorlandMakeCurlyHack)
{
@@ -1094,6 +1096,35 @@ cmLocalUnixMakefileGenerator3
}
//----------------------------------------------------------------------------
+std::string
+cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
+ cmTarget* target,
+ RelativeRoot relative)
+{
+ // Short-circuit if there is no launcher.
+ const char* prop = "RULE_LAUNCH_CUSTOM";
+ const char* val = this->GetRuleLauncher(target, prop);
+ if(!(val && *val))
+ {
+ return "";
+ }
+
+ // Expand rules in the empty string. It may insert the launcher and
+ // perform replacements.
+ RuleVariables vars;
+ vars.RuleLauncher = prop;
+ vars.CMTarget = target;
+
+ std::string launcher;
+ this->ExpandRuleVariables(launcher, vars);
+ if(!launcher.empty())
+ {
+ launcher += " ";
+ }
+ return launcher;
+}
+
+//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3
::AppendCleanCommand(std::vector<std::string>& commands,