1
0

cmDepends.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. #ifndef cmDepends_h
  14. #define cmDepends_h
  15. #include "cmStandardIncludes.h"
  16. /** \class cmDepends
  17. * \brief Dependency scanner superclass.
  18. *
  19. * This class is responsible for maintaining a .depends.make file in
  20. * the build tree corresponding to an object file. Subclasses help it
  21. * maintain dependencies for particular languages.
  22. */
  23. class cmDepends
  24. {
  25. public:
  26. /** Instances need to know the build directory name and the relative
  27. path from the build directory to the target file. */
  28. cmDepends(const char* dir, const char* targetFile);
  29. /** Virtual destructor to cleanup subclasses properly. */
  30. virtual ~cmDepends();
  31. /** Write dependencies for the target file. */
  32. bool Write();
  33. /** Check dependencies for the target file. */
  34. void Check();
  35. /** Clear dependencies for the target file so they will be regenerated. */
  36. void Clear();
  37. /** Get the name of the dependency make file. */
  38. const char* GetMakeFileName();
  39. /** Get the name of the dependency mark file. */
  40. const char* GetMarkFileName();
  41. protected:
  42. // Write dependencies for the target file to the given stream.
  43. // Return true for success and false for failure.
  44. virtual bool WriteDependencies(std::ostream& os)=0;
  45. // Check dependencies for the target file in the given stream.
  46. // Return false if dependencies must be regenerated and true
  47. // otherwise.
  48. virtual bool CheckDependencies(std::istream& is)=0;
  49. // The directory in which the build rule for the target file is executed.
  50. std::string m_Directory;
  51. // The name of the target file for which dependencies are maintained.
  52. std::string m_TargetFile;
  53. // The name of the .depends.make file corresponding to the target.
  54. std::string m_DependsMakeFile;
  55. // The name of the .depends file marking when dependencies were generated.
  56. std::string m_DependsMarkFile;
  57. private:
  58. cmDepends(cmDepends const&); // Purposely not implemented.
  59. void operator=(cmDepends const&); // Purposely not implemented.
  60. };
  61. #endif