summaryrefslogtreecommitdiffstats
path: root/Source/cmVariableRequiresCommand.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-11-19 22:52:08 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-11-19 22:52:08 (GMT)
commitda17f30cb515775000ec7dd1d3fab8b3621c2587 (patch)
tree9548b3afab27b95fb4defa16b17aadfd02654d1a /Source/cmVariableRequiresCommand.cxx
parent4d5f9deb00f851477258da139cde8362d14674c4 (diff)
downloadCMake-da17f30cb515775000ec7dd1d3fab8b3621c2587.zip
CMake-da17f30cb515775000ec7dd1d3fab8b3621c2587.tar.gz
CMake-da17f30cb515775000ec7dd1d3fab8b3621c2587.tar.bz2
ENH: add new command VARIABLE_REQUIRES for better debugging of list files
Diffstat (limited to 'Source/cmVariableRequiresCommand.cxx')
-rw-r--r--Source/cmVariableRequiresCommand.cxx45
1 files changed, 33 insertions, 12 deletions
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index d108e8b..a4352b1 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -44,29 +44,50 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// cmLibraryCommand
bool cmVariableRequiresCommand::InitialPass(std::vector<std::string> const& args)
{
- if(args.size() < 4 )
+ if(args.size() < 3 )
{
this->SetError("called with incorrect number of arguments");
return false;
}
- std::string testVarible = args[0];
- if(m_Makefile->IsON(testVarible.c_str()))
+ m_Arguments = args;
+ return true;
+}
+
+void cmVariableRequiresCommand::FinalPass()
+{
+ std::string testVarible = m_Arguments[0];
+ if(!m_Makefile->IsOn(testVarible.c_str()))
{
- return true;
+ return;
}
- std::string resultVarible = args[1];
- std::string message = args[2];
+ std::string resultVarible = m_Arguments[1];
bool requirementsMet = true;
std::string notSet;
- for(int i = 3; i < args.size(); ++i)
+ for(int i = 2; i < m_Arguments.size(); ++i)
{
- if(!m_Makefile->IsOn(args[i].c_str()))
+ if(!m_Makefile->IsOn(m_Arguments[i].c_str()))
{
requirementsMet = false;
- notSet += args[i];
- notSet += " ";
+ notSet += m_Arguments[i];
+ notSet += "\n";
}
}
- return true;
-}
+ const char* reqVar = m_Makefile->GetDefinition(resultVarible.c_str());
+ // if reqVar is unset, then set it to requirementsMet
+ // if reqVar is set to true, but requirementsMet is false , then
+ // set reqVar to false.
+ if(!reqVar || (!requirementsMet && m_Makefile->IsOn(reqVar)))
+ {
+ m_Makefile->AddDefinition(resultVarible.c_str(), requirementsMet);
+ }
+ if(!requirementsMet)
+ {
+ std::string message = "Variable assertion failed:\n";
+ message += testVarible + " Requires that the following unset varibles are set:\n";
+ message += notSet;
+ message += "\nPlease set them, or set ";
+ message += testVarible + " to false, and re-configure.";
+ cmSystemTools::Error(message.c_str());
+ }
+}