cmMarkAsAdvancedCommand.cxx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "cmMarkAsAdvancedCommand.h"
  14. // cmMarkAsAdvancedCommand
  15. bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. if(args.size() < 1 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. unsigned int i =0;
  23. const char* value = "1";
  24. bool overwrite = false;
  25. if(args[0] == "CLEAR" || args[0] == "FORCE")
  26. {
  27. overwrite = true;
  28. if(args[0] == "CLEAR")
  29. {
  30. value = "0";
  31. }
  32. i = 1;
  33. }
  34. for(; i < args.size(); ++i)
  35. {
  36. std::string variable = args[i];
  37. variable += "-ADVANCED";
  38. std::string doc = "Advanced flag for variable: ";
  39. doc += args[i];
  40. // if not CLEAR or FORCE or it is not yet defined,
  41. // then define variable-ADVANCED
  42. if(overwrite || !m_Makefile->GetDefinition(variable.c_str()))
  43. {
  44. m_Makefile->AddCacheDefinition(variable.c_str(), value,
  45. doc.c_str(),
  46. cmCacheManager::INTERNAL);
  47. }
  48. }
  49. return true;
  50. }