cmMarkAsAdvancedCommand.cxx 1.7 KB

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