cmElseCommand.cxx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2000 National Library of Medicine
  8. All rights reserved.
  9. See COPYRIGHT.txt for copyright details.
  10. =========================================================================*/
  11. #include "cmElseCommand.h"
  12. #include "cmCacheManager.h"
  13. bool cmElseCommand::Invoke(std::vector<std::string>& args)
  14. {
  15. if(args.size() < 1 )
  16. {
  17. this->SetError("called with incorrect number of arguments");
  18. return false;
  19. }
  20. // check to see if the argument is defined first
  21. const char *def = m_Makefile->GetDefinition(args[0].c_str());
  22. if(cmSystemTools::IsOn(def))
  23. {
  24. // add block
  25. cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
  26. f->m_Define = args[0];
  27. m_Makefile->AddFunctionBlocker(f);
  28. }
  29. else
  30. {
  31. // remove any function blockers for this define
  32. m_Makefile->RemoveFunctionBlocker("ENDIF",args);
  33. }
  34. return true;
  35. }