cmOptionCommand.cxx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "cmOptionCommand.h"
  14. // cmOptionCommand
  15. bool cmOptionCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. if(args.size() < 2 || args.size() > 3)
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. // Now check and see if the value has been stored in the cache
  23. // already, if so use that value and don't look for the program
  24. const char* cacheValue
  25. = m_Makefile->GetDefinition(args[0].c_str());
  26. if(!cacheValue)
  27. {
  28. std::string initialValue = "Off";
  29. if(args.size() == 3)
  30. {
  31. initialValue = args[2];
  32. }
  33. m_Makefile->AddCacheDefinition(args[0].c_str(),
  34. cmSystemTools::IsOn(initialValue.c_str()),
  35. args[1].c_str());
  36. }
  37. return true;
  38. }