better If checks
This commit is contained in:
parent
dd2876adb0
commit
faaadc4a08
|
@ -59,11 +59,19 @@ public:
|
|||
const cmMakefile &mf) const = 0;
|
||||
|
||||
/**
|
||||
* should this function blocker be removed, useful when one function adds a blocker
|
||||
* and another must remove it
|
||||
* should this function blocker be removed, useful when one function adds a
|
||||
* blocker and another must remove it
|
||||
*/
|
||||
virtual bool ShouldRemove(const char *name, const std::vector<std::string> &args,
|
||||
virtual bool ShouldRemove(const char *name,
|
||||
const std::vector<std::string> &args,
|
||||
const cmMakefile &mf) const {return false;}
|
||||
|
||||
/**
|
||||
* When the end of a CMakeList file is reached this method is called. It
|
||||
* is not called on the end of an INCLUDE cmake file, just at the end of a
|
||||
* regular CMakeList file
|
||||
*/
|
||||
virtual void ScopeEnded(const cmMakefile &mf) const {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,6 +68,15 @@ ShouldRemove(const char *name, const std::vector<std::string> &args,
|
|||
return !this->IsFunctionBlocked(name,args,mf);
|
||||
}
|
||||
|
||||
void cmIfFunctionBlocker::
|
||||
ScopeEnded(const cmMakefile &mf) const
|
||||
{
|
||||
cmSystemTools::Error("The end of a CMakeLists file was reached with an IF statement that was not closed properly. Within the directory: ",
|
||||
mf.GetCurrentDirectory(),
|
||||
(m_Not ? " The arguments to the if were: NOT " : " The arguments to the if were: "),
|
||||
m_Define.c_str());
|
||||
}
|
||||
|
||||
bool cmIfCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
if(args.size() < 1 )
|
||||
|
|
|
@ -55,10 +55,14 @@ class cmIfFunctionBlocker : public cmFunctionBlocker
|
|||
public:
|
||||
cmIfFunctionBlocker() {m_Not = false;}
|
||||
virtual ~cmIfFunctionBlocker() {}
|
||||
virtual bool IsFunctionBlocked(const char *name, const std::vector<std::string> &args,
|
||||
virtual bool IsFunctionBlocked(const char *name,
|
||||
const std::vector<std::string> &args,
|
||||
const cmMakefile &mf) const;
|
||||
virtual bool ShouldRemove(const char *name, const std::vector<std::string> &args,
|
||||
virtual bool ShouldRemove(const char *name,
|
||||
const std::vector<std::string> &args,
|
||||
const cmMakefile &mf) const;
|
||||
virtual void ScopeEnded(const cmMakefile &mf) const;
|
||||
|
||||
std::string m_Define;
|
||||
bool m_Not;
|
||||
};
|
||||
|
|
|
@ -290,6 +290,19 @@ bool cmMakefile::ReadListFile(const char* filename, const char* external)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send scope ended to and funciton blockers
|
||||
if (filename)
|
||||
{
|
||||
// loop over all function blockers to see if any block this command
|
||||
std::set<cmFunctionBlocker *>::const_iterator pos;
|
||||
for (pos = m_FunctionBlockers.begin();
|
||||
pos != m_FunctionBlockers.end(); ++pos)
|
||||
{
|
||||
(*pos)->ScopeEnded(*this);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ bool cmVTKWrapJavaCommand::Invoke(std::vector<std::string>& args)
|
|||
|
||||
// add in a depend in the vtkVTKWrapJava executable
|
||||
m_Makefile->AddUtility("vtkWrapJava");
|
||||
m_Makefile->AddUtility("vtkParseJava");
|
||||
|
||||
// what is the current source dir
|
||||
std::string cdir = m_Makefile->GetCurrentDirectory();
|
||||
|
@ -108,25 +109,25 @@ void cmVTKWrapJavaCommand::FinalPass()
|
|||
|
||||
// wrap all the .h files
|
||||
depends.push_back(wjava);
|
||||
depends.push_back(pjava);
|
||||
for(int classNum = 0; classNum < lastClass; classNum++)
|
||||
{
|
||||
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
|
||||
|
||||
// wrap java
|
||||
std::string res = m_WrapClasses[classNum].GetSourceName() + ".cxx";
|
||||
std::string res2 = m_OriginalNames[classNum] + ".java";
|
||||
std::vector<std::string> resvec;
|
||||
resvec.push_back(res);
|
||||
resvec.push_back(res2);
|
||||
|
||||
std::string cmd = wjava + " " + m_WrapHeaders[classNum] + " "
|
||||
+ hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].GetSourceName() + ".cxx";
|
||||
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
|
||||
cmd.c_str(), depends,
|
||||
res.c_str(), m_LibraryName.c_str());
|
||||
|
||||
// parse java
|
||||
res = m_WrapClasses[classNum].GetSourceName() + ".cxx";
|
||||
cmd = pjava + " " + m_WrapHeaders[classNum] + " "
|
||||
+ hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].GetSourceName() + ".cxx\\\n\t" +
|
||||
pjava + " " + m_WrapHeaders[classNum] + " "
|
||||
+ hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_OriginalNames[classNum] + ".java";
|
||||
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
|
||||
cmd.c_str(), depends,
|
||||
res.c_str(), m_LibraryName.c_str());
|
||||
resvec, m_LibraryName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue