summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommand.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/cmCustomCommand.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/cmCustomCommand.cxx')
-rw-r--r--Source/cmCustomCommand.cxx85
1 files changed, 35 insertions, 50 deletions
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index fffa51d..d677798 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -9,74 +9,59 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "cmCustomCommand.h"
-#include "cmMakefile.h"
-/**
- * The constructor
- */
-cmCustomCommand::cmCustomCommand(const char *command,
- const char* arguments,
- std::vector<std::string> dep,
- const char *out):
- m_Command(command),
- m_Arguments(arguments),
- m_Depends(dep)
+//----------------------------------------------------------------------------
+cmCustomCommand::cmCustomCommand()
{
- if (out)
- {
- m_Output = out;
- }
}
-cmCustomCommand::cmCustomCommand(const char *command,
- const char* arguments):
- m_Command(command),
- m_Arguments(arguments)
+//----------------------------------------------------------------------------
+cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
+ m_Output(r.m_Output),
+ m_Depends(r.m_Depends),
+ m_CommandLines(r.m_CommandLines),
+ m_Comment(r.m_Comment)
{
}
-/**
- * Copy constructor.
- */
-cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
- m_Command(r.m_Command),
- m_Arguments(r.m_Arguments),
- m_Comment(r.m_Comment),
- m_Output(r.m_Output),
- m_Depends(r.m_Depends)
+//----------------------------------------------------------------------------
+cmCustomCommand::cmCustomCommand(const char* output,
+ const std::vector<std::string>& depends,
+ const cmCustomCommandLines& commandLines,
+ const char* comment):
+ m_Output(output?output:""),
+ m_Depends(depends),
+ m_CommandLines(commandLines),
+ m_Comment(comment?comment:"")
{
}
-void cmCustomCommand::ExpandVariables(const cmMakefile &mf)
+//----------------------------------------------------------------------------
+const char* cmCustomCommand::GetOutput() const
{
- mf.ExpandVariablesInString(m_Command);
- mf.ExpandVariablesInString(m_Arguments);
- mf.ExpandVariablesInString(m_Output);
+ return m_Output.c_str();
+}
- for (std::vector<std::string>::iterator i = m_Depends.begin();
- i != m_Depends.end(); ++i)
- {
- mf.ExpandVariablesInString(*i);
- }
+//----------------------------------------------------------------------------
+const std::vector<std::string>& cmCustomCommand::GetDepends() const
+{
+ return m_Depends;
}
+//----------------------------------------------------------------------------
+const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
+{
+ return m_CommandLines;
+}
-bool cmCustomCommand::IsEquivalent(const char* command,
- const char* args)
+//----------------------------------------------------------------------------
+const char* cmCustomCommand::GetComment() const
{
- if(m_Command != command)
- {
- return false;
- }
- if(m_Arguments != args)
- {
- return false;
- }
- return true;
+ return m_Comment.c_str();
}