cmGetSourceFilePropertyCommand.cxx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 "cmGetSourceFilePropertyCommand.h"
  14. // cmSetSourceFilePropertyCommand
  15. bool cmGetSourceFilePropertyCommand::InitialPass(std::vector<std::string> const&
  16. args)
  17. {
  18. if(args.size() != 3 )
  19. {
  20. this->SetError("called with incorrect number of arguments");
  21. return false;
  22. }
  23. const char* var = args[0].c_str();
  24. const char* file = args[1].c_str();
  25. cmSourceFile* sf = m_Makefile->GetSource(file);
  26. if(sf)
  27. {
  28. if(args[2] == "ABSTRACT")
  29. {
  30. m_Makefile->AddDefinition(var, sf->IsAnAbstractClass());
  31. }
  32. if(args[2] == "WRAP_EXCLUDE")
  33. {
  34. m_Makefile->AddDefinition(var, sf->GetWrapExclude());
  35. }
  36. if(args[2] == "COMPILE_FLAGS")
  37. {
  38. m_Makefile->AddDefinition(var, sf->GetCompileFlags());
  39. }
  40. }
  41. else
  42. {
  43. std::string m = "Could not find source file: ";
  44. m += file;
  45. this->SetError(m.c_str());
  46. return false;
  47. }
  48. return true;
  49. }