summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-04-11 15:06:19 (GMT)
committerBrad King <brad.king@kitware.com>2006-04-11 15:06:19 (GMT)
commitd5719f22c1dca3e100f1e3b5dfaa4fe7d26796a0 (patch)
tree714a99bed97290f96ff8f846fa6864cebbdc0a28 /Source/cmLocalGenerator.cxx
parentb613cf0be806cc1d37d2b590f1a5ba7898236ae8 (diff)
downloadCMake-d5719f22c1dca3e100f1e3b5dfaa4fe7d26796a0.zip
CMake-d5719f22c1dca3e100f1e3b5dfaa4fe7d26796a0.tar.gz
CMake-d5719f22c1dca3e100f1e3b5dfaa4fe7d26796a0.tar.bz2
ENH: Added support for multiple outputs generated by a single custom command. For Visual Studio generators the native tool provides support. For Xcode and Makefile generators a simple trick is used. The first output is considered primary and has the build rule attached. Other outputs simply depend on the first output with no build rule. During cmake_check_build_system CMake detects when a secondary output is missing and removes the primary output to make sure all outputs are regenerated. This approach always builds the custom command at the right time and only once even during parallel builds.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 14205b4..bd4b9b0 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1670,6 +1670,37 @@ cmLocalGenerator::ConstructScript(const cmCustomCommandLines& commandLines,
//----------------------------------------------------------------------------
std::string
+cmLocalGenerator::ConstructComment(const cmCustomCommand& cc,
+ const char* default_comment)
+{
+ // Check for a comment provided with the command.
+ if(cc.GetComment() && *cc.GetComment())
+ {
+ return cc.GetComment();
+ }
+
+ // Construct a reasonable default comment if possible.
+ if(!cc.GetOutputs().empty())
+ {
+ std::string comment;
+ comment = "Generating ";
+ const char* sep = "";
+ for(std::vector<std::string>::const_iterator o = cc.GetOutputs().begin();
+ o != cc.GetOutputs().end(); ++o)
+ {
+ comment += sep;
+ comment += this->Convert(o->c_str(), cmLocalGenerator::START_OUTPUT);
+ sep = ", ";
+ }
+ return comment;
+ }
+
+ // Otherwise use the provided default.
+ return default_comment;
+}
+
+//----------------------------------------------------------------------------
+std::string
cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(const char* remote)
{
return this->Convert(remote, START_OUTPUT, SHELL, true);