cmGetTargetPropertyCommand.cxx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 "cmGetTargetPropertyCommand.h"
  11. // cmSetTargetPropertyCommand
  12. bool cmGetTargetPropertyCommand
  13. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  14. {
  15. if(args.size() != 3 )
  16. {
  17. this->SetError("called with incorrect number of arguments");
  18. return false;
  19. }
  20. std::string var = args[0].c_str();
  21. const char* targetName = args[1].c_str();
  22. if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName))
  23. {
  24. cmTarget& target = *tgt;
  25. const char *prop = target.GetProperty(args[2].c_str());
  26. if (prop)
  27. {
  28. this->Makefile->AddDefinition(var.c_str(), prop);
  29. return true;
  30. }
  31. }
  32. this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str());
  33. return true;
  34. }