cmAddDependenciesCommand.cxx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmAddDependenciesCommand.h"
  11. #include "cmLocalGenerator.h"
  12. #include "cmGlobalGenerator.h"
  13. // cmDependenciesCommand
  14. bool cmAddDependenciesCommand
  15. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  16. {
  17. if(args.size() < 2 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. std::string target_name = args[0];
  23. if(cmTarget* target = this->Makefile->FindTargetToUse(target_name.c_str()))
  24. {
  25. std::vector<std::string>::const_iterator s = args.begin();
  26. ++s; // skip over target_name
  27. for (; s != args.end(); ++s)
  28. {
  29. target->AddUtility(s->c_str());
  30. }
  31. }
  32. else
  33. {
  34. std::string error = "Adding dependency to non-existent target: ";
  35. error += target_name;
  36. this->SetError(error.c_str());
  37. return false;
  38. }
  39. return true;
  40. }