cmAbstractFilesCommand.cxx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 "cmAbstractFilesCommand.h"
  14. #include "cmMakefile.h"
  15. #include "cmSourceFile.h"
  16. // cmAbstractFilesCommand
  17. bool cmAbstractFilesCommand::InitialPass(std::vector<std::string> const& args)
  18. {
  19. const char* versionValue
  20. = m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
  21. if (versionValue && atof(versionValue) > 1.2)
  22. {
  23. this->SetError("The ABSTRACT_FILES command has been deprecated in CMake version 1.4. You should use the SET_SOURCE_FILES_PROPERTIES command instead.\n");
  24. return false;
  25. }
  26. if(args.size() < 1 )
  27. {
  28. this->SetError("called with incorrect number of arguments");
  29. return false;
  30. }
  31. bool ret = true;
  32. std::string m = "could not find source file(s):\n";
  33. for(std::vector<std::string>::const_iterator j = args.begin();
  34. j != args.end(); ++j)
  35. {
  36. cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
  37. if(sf)
  38. {
  39. sf->SetProperty("ABSTRACT","1");
  40. }
  41. else
  42. {
  43. // for VTK 4.0 we have to support missing abstract sources
  44. if(m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"))
  45. {
  46. m += *j;
  47. m += "\n";
  48. ret = false;
  49. }
  50. }
  51. }
  52. if(!ret)
  53. {
  54. this->SetError(m.c_str());
  55. }
  56. return ret;
  57. }