cmDepends.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 cmFileTimeComparison;
  17. /** \class cmDepends
  18. * \brief Dependency scanner superclass.
  19. *
  20. * This class is responsible for maintaining a .depends.make file in
  21. * the build tree corresponding to an object file. Subclasses help it
  22. * maintain dependencies for particular languages.
  23. */
  24. class cmDepends
  25. {
  26. public:
  27. /** Instances need to know the build directory name and the relative
  28. path from the build directory to the target file. */
  29. cmDepends();
  30. /** at what level will the compile be done from */
  31. void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;};
  32. /** should this be verbose in its output */
  33. void SetVerbose(bool verb) { this->Verbose = verb; }
  34. /** Virtual destructor to cleanup subclasses properly. */
  35. virtual ~cmDepends();
  36. /** Write dependencies for the target file. */
  37. bool Write(const char *src, const char *obj,
  38. std::ostream &makeDepends, std::ostream &internalDepends);
  39. /** Check dependencies for the target file. */
  40. void Check(const char *makeFile, const char* internalFile);
  41. /** Clear dependencies for the target file so they will be regenerated. */
  42. void Clear(const char *file);
  43. /** Set the file comparison object */
  44. void SetFileComparison(cmFileTimeComparison* fc) {
  45. this->FileComparison = fc; }
  46. protected:
  47. // Write dependencies for the target file to the given stream.
  48. // Return true for success and false for failure.
  49. virtual bool WriteDependencies(const char *src, const char* obj,
  50. std::ostream& makeDepends, std::ostream& internalDepends)=0;
  51. // Check dependencies for the target file in the given stream.
  52. // Return false if dependencies must be regenerated and true
  53. // otherwise.
  54. virtual bool CheckDependencies(std::istream& internalDepends);
  55. // The directory in which the build rule for the target file is executed.
  56. std::string Directory;
  57. std::string CompileDirectory;
  58. // Flag for verbose output.
  59. bool Verbose;
  60. cmFileTimeComparison* FileComparison;
  61. size_t MaxPath;
  62. char* Dependee;
  63. char* Depender;
  64. private:
  65. cmDepends(cmDepends const&); // Purposely not implemented.
  66. void operator=(cmDepends const&); // Purposely not implemented.
  67. };
  68. #endif