cmElseCommand.cxx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmElseCommand.h"
  14. #include "cmCacheManager.h"
  15. bool cmElseCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. bool isValid;
  18. bool isTrue = cmIfCommand::IsTrue(args,isValid,m_Makefile);
  19. if (!isValid)
  20. {
  21. this->SetError("An ELSE command had incorrect arguments");
  22. return false;
  23. }
  24. // first remove any function blockers for the IF
  25. m_Makefile->RemoveFunctionBlocker("ELSE",args);
  26. // if is true create a blocker for the else
  27. cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
  28. f->m_IsBlocking = isTrue;
  29. for(std::vector<std::string>::const_iterator j = args.begin();
  30. j != args.end(); ++j)
  31. {
  32. f->m_Args.push_back(*j);
  33. }
  34. m_Makefile->AddFunctionBlocker(f);
  35. return true;
  36. }