diff options
author | Ken Martin <ken.martin@kitware.com> | 2001-08-06 21:01:26 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2001-08-06 21:01:26 (GMT) |
commit | d7702b4c302a15b2b20dc747112605ab0d84f1a5 (patch) | |
tree | 3a013a875934452cb25e3f2b26a4763c6a971a49 /Source/cmElseCommand.cxx | |
parent | f70e0d6b1ee7aa36a51ad7b4c955a9d0979ddc0a (diff) | |
download | CMake-d7702b4c302a15b2b20dc747112605ab0d84f1a5.zip CMake-d7702b4c302a15b2b20dc747112605ab0d84f1a5.tar.gz CMake-d7702b4c302a15b2b20dc747112605ab0d84f1a5.tar.bz2 |
added new if commands
Diffstat (limited to 'Source/cmElseCommand.cxx')
-rw-r--r-- | Source/cmElseCommand.cxx | 75 |
1 files changed, 56 insertions, 19 deletions
diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx index 6f81528..4aca32a 100644 --- a/Source/cmElseCommand.cxx +++ b/Source/cmElseCommand.cxx @@ -49,42 +49,79 @@ bool cmElseCommand::InitialPass(std::vector<std::string>& args) return false; } - // check for the NOT vale + // create a function blocker + cmIfFunctionBlocker *f = NULL; + + // check for the different signatures const char *def; + const char *def2; + + if (args.size() == 1) + { + def = m_Makefile->GetDefinition(args[0].c_str()); + if(!cmSystemTools::IsOff(def)) + { + f = new cmIfFunctionBlocker(); + } + } + if (args.size() == 2 && (args[0] == "NOT")) { def = m_Makefile->GetDefinition(args[1].c_str()); - if(!cmSystemTools::IsOff(def)) + if(cmSystemTools::IsOff(def)) { - // remove any function blockers for this define - m_Makefile->RemoveFunctionBlocker("ENDIF",args); + f = new cmIfFunctionBlocker(); } - else + } + + if (args.size() == 3 && (args[1] == "AND")) + { + def = m_Makefile->GetDefinition(args[0].c_str()); + def2 = m_Makefile->GetDefinition(args[2].c_str()); + if(cmSystemTools::IsOff(def) || cmSystemTools::IsOff(def2)) { - // create a function blocker - cmIfFunctionBlocker *f = new cmIfFunctionBlocker(); - f->m_Define = args[1]; - f->m_Not = true; - m_Makefile->AddFunctionBlocker(f); + f = new cmIfFunctionBlocker(); } } - else + + if (args.size() == 3 && (args[1] == "OR")) { def = m_Makefile->GetDefinition(args[0].c_str()); - if(!cmSystemTools::IsOff(def)) + def2 = m_Makefile->GetDefinition(args[2].c_str()); + if(cmSystemTools::IsOff(def) && cmSystemTools::IsOff(def2)) { - // create a function blocker - cmIfFunctionBlocker *f = new cmIfFunctionBlocker(); - f->m_Define = args[0]; - m_Makefile->AddFunctionBlocker(f); + f = new cmIfFunctionBlocker(); } - else + } + + if (args.size() == 3 && (args[1] == "MATCHES")) + { + def = m_Makefile->GetDefinition(args[0].c_str()); + cmRegularExpression regEntry(args[2].c_str()); + + // check for black line or comment + if (!regEntry.find(def)) { - // remove any function blockers for this define - m_Makefile->RemoveFunctionBlocker("ENDIF",args); + f = new cmIfFunctionBlocker(); } } + // if we created a function blocker then set its args + if (f) + { + for(std::vector<std::string>::iterator j = args.begin(); + j != args.end(); ++j) + { + f->m_Args.push_back(*j); + } + m_Makefile->AddFunctionBlocker(f); + } + else + { + // remove any function blockers for this define + m_Makefile->RemoveFunctionBlocker("ENDIF",args); + } + return true; } |