summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/cmIfCommand.cxx8
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmMakefile.h2
3 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 903746a61a..e25502e4f3 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -110,6 +110,14 @@ bool cmIfCommand::InitialPass(std::vector<std::string> const& args)
}
}
+ if (args.size() == 2 && (args[0] == "COMMAND"))
+ {
+ if(!m_Makefile->CommandExists(args[1].c_str()))
+ {
+ f = new cmIfFunctionBlocker();
+ }
+ }
+
if (args.size() == 3 && (args[1] == "AND"))
{
def = m_Makefile->GetDefinition(args[0].c_str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 81b4b33231..c9cf6eeadd 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -214,7 +214,10 @@ void cmMakefile::Print() const
}
}
-
+bool cmMakefile::CommandExists(const char* name) const
+{
+ return (m_Commands.find(name) != m_Commands.end());
+}
void cmMakefile::ExecuteCommand(std::string &name,
std::vector<std::string> const& arguments)
@@ -1187,7 +1190,6 @@ cmMakefile::FindSourceGroup(const char* source,
return groups.front();
}
-
bool cmMakefile::IsFunctionBlocked(const char *name,
std::vector<std::string> const&args)
{
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 44d4d61a3e..9631bd353f 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -534,6 +534,8 @@ public:
*/
void ExecuteCommand(std::string &name, std::vector<std::string> const& args);
+ /** Check if a command exists. */
+ bool CommandExists(const char* name) const;
protected:
std::string m_Prefix;