cmClassFile.cxx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifdef _MSC_VER
  2. #pragma warning ( disable : 4786 )
  3. #endif
  4. #include "cmClassFile.h"
  5. #include "cmSystemTools.h"
  6. #include <iostream>
  7. // Set the name of the class and the full path to the file.
  8. // The class must be found in dir and end in name.cxx, name.txx,
  9. // name.c or it will be considered a header file only class
  10. // and not included in the build process
  11. void cmClassFile::SetName(const char* name, const char* dir)
  12. {
  13. m_HeaderFileOnly = true;
  14. m_ClassName = name;
  15. std::string pathname = dir;
  16. if(pathname != "")
  17. {
  18. pathname += "/";
  19. }
  20. pathname += m_ClassName;
  21. std::string hname = pathname;
  22. hname += ".cxx";
  23. if(cmSystemTools::FileExists(hname.c_str()))
  24. {
  25. m_HeaderFileOnly = false;
  26. m_FullPath = hname;
  27. return;
  28. }
  29. hname = pathname;
  30. hname += ".c";
  31. if(cmSystemTools::FileExists(hname.c_str()))
  32. {
  33. m_HeaderFileOnly = false;
  34. m_FullPath = hname;
  35. return;
  36. }
  37. hname = pathname;
  38. hname += ".txx";
  39. if(cmSystemTools::FileExists(hname.c_str()))
  40. {
  41. m_HeaderFileOnly = false;
  42. m_FullPath = hname;
  43. return;
  44. }
  45. hname = pathname;
  46. hname += ".h";
  47. if(!cmSystemTools::FileExists(hname.c_str()))
  48. {
  49. std::cerr << "ERROR, can not find file " << hname;
  50. std::cerr << "Tried .txx .cxx .c " << std::endl;
  51. }
  52. }
  53. void cmClassFile::Print()
  54. {
  55. if(m_AbstractClass)
  56. std::cout << "Abstract ";
  57. else
  58. std::cout << "Concrete ";
  59. if(m_HeaderFileOnly)
  60. std::cout << "Header file ";
  61. else
  62. std::cout << "CXX file ";
  63. std::cout << m_ClassName << std::endl;
  64. }