ENH: Added option to IF command to test if a command exists. Syntax is IF(COMMAND name-of-command).
This commit is contained in:
parent
dca0fd0859
commit
fd37e46eb3
|
@ -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());
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue