You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  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 "cmAddDependenciesCommand.h"
  14. #include "cmCacheManager.h"
  15. // cmDependenciesCommand
  16. bool cmAddDependenciesCommand::InitialPass(std::vector<std::string> const& argsIn)
  17. {
  18. if(argsIn.size() < 2 )
  19. {
  20. this->SetError("called with incorrect number of arguments");
  21. return false;
  22. }
  23. std::vector<std::string> args;
  24. cmSystemTools::ExpandListArguments(argsIn, args);
  25. std::string target_name = args[0];
  26. cmTargets &tgts = m_Makefile->GetTargets();
  27. if (tgts.find(target_name) != tgts.end())
  28. {
  29. std::vector<std::string>::const_iterator s = args.begin();
  30. ++s;
  31. for (; s != args.end(); ++s)
  32. {
  33. tgts[target_name].AddUtility(s->c_str());
  34. }
  35. }
  36. else
  37. {
  38. std::string error = "Adding dependency to non-existent target: ";
  39. error += target_name;
  40. this->SetError(error.c_str());
  41. return false;
  42. }
  43. return true;
  44. }