cmGetSourceFilePropertyCommand.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "cmGetSourceFilePropertyCommand.h"
  14. #include "cmSourceFile.h"
  15. // cmSetSourceFilePropertyCommand
  16. bool cmGetSourceFilePropertyCommand::InitialPass(
  17. std::vector<std::string> const& args)
  18. {
  19. if(args.size() != 3 )
  20. {
  21. this->SetError("called with incorrect number of arguments");
  22. return false;
  23. }
  24. const char* var = args[0].c_str();
  25. const char* file = args[1].c_str();
  26. cmSourceFile* sf = m_Makefile->GetSource(file);
  27. if(sf)
  28. {
  29. const char *prop = sf->GetProperty(args[2].c_str());
  30. if (prop)
  31. {
  32. m_Makefile->AddDefinition(var, prop);
  33. return true;
  34. }
  35. }
  36. m_Makefile->AddDefinition(var, "NOTFOUND");
  37. return true;
  38. }