summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-02-22 15:32:44 (GMT)
committerBrad King <brad.king@kitware.com>2005-02-22 15:32:44 (GMT)
commit39af9ee1e496db77849015541f687897ed819a56 (patch)
tree79bd7c1765408c80822dc9b87853bdac24704332 /Source/cmLocalGenerator.cxx
parent4d30cb309cc0cd191e89a7969599b79dea111a08 (diff)
downloadCMake-39af9ee1e496db77849015541f687897ed819a56.zip
CMake-39af9ee1e496db77849015541f687897ed819a56.tar.gz
CMake-39af9ee1e496db77849015541f687897ed819a56.tar.bz2
ENH: Updated implementation of custom commands. Multiple command lines are now supported effectively allowing entire scripts to be written. Also removed extra variable expansions and cleaned up passing of commands through to the generators. The command and individual arguments are now kept separate all the way until the generator writes them out. This cleans up alot of escaping issues.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx35
1 files changed, 34 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b505712..2faf647 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -509,6 +509,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
sourceAndDeps.push_back(this->ConvertToRelativeOutputPath(i->c_str()));
}
}
+#if 0
std::string command;
std::string args;
cmSystemTools::SplitProgramFromArgs(commands[0].c_str(), command, args);
@@ -520,6 +521,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
source.GetFullPath().c_str(),
sourceAndDeps,
"build from source");
+#endif
}
void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
@@ -577,13 +579,16 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
0, // target so name,
linkFlags.c_str() // link flags
);
+#if 0
std::string command;
std::string args;
cmSystemTools::SplitProgramFromArgs(rule.c_str(), command, args);
// Just like ADD_CUSTOM_TARGET(foo ALL DEPENDS a.o b.o)
// Add a custom command for generating each .o file
- cmCustomCommand cc(command.c_str(), args.c_str(), objVector, targetName.c_str());
+ cmCustomCommand cc(command.c_str(), args.c_str(), objVector,
+ targetName.c_str(), 0);
target.GetPostBuildCommands().push_back(cc);
+#endif
}
@@ -1342,3 +1347,31 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
}
}
+//----------------------------------------------------------------------------
+std::string
+cmLocalGenerator::ConstructScript(const cmCustomCommandLines& commandLines,
+ const char* newline)
+{
+ // Store the script in a string.
+ std::string script;
+
+ // Write each command on a single line.
+ for(cmCustomCommandLines::const_iterator cl = commandLines.begin();
+ cl != commandLines.end(); ++cl)
+ {
+ // Start with the command name.
+ const cmCustomCommandLine& commandLine = *cl;
+ script += this->ConvertToRelativeOutputPath(commandLine[0].c_str());
+
+ // Add the arguments.
+ for(unsigned int j=1;j < commandLine.size(); ++j)
+ {
+ script += " ";
+ script += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
+ }
+
+ // End the line.
+ script += newline;
+ }
+ return script;
+}