cmElseCommand.cxx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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(def && strcmp(def,"0") && strcmp(def,"false") && strcmp(def,"") &&
  23. strcmp(def,"NOTFOUND"))
  24. {
  25. // add block
  26. cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
  27. f->m_Define = args[0];
  28. m_Makefile->AddFunctionBlocker(f);
  29. }
  30. else
  31. {
  32. // remove any function blockers for this define
  33. m_Makefile->RemoveFunctionBlocker("ENDIF",args);
  34. }
  35. return true;
  36. }