cmDependsCompiler.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <functional>
  6. #include <iosfwd>
  7. #include <string>
  8. #include <vector>
  9. #include "cmDepends.h"
  10. class cmLocalUnixMakefileGenerator3;
  11. /** \class cmDepends
  12. * \brief Dependencies files manager.
  13. *
  14. * This class is responsible for maintaining a compiler_depends.make file in
  15. * the build tree corresponding to an object file.
  16. */
  17. class cmDependsCompiler
  18. {
  19. public:
  20. cmDependsCompiler() = default;
  21. ~cmDependsCompiler() = default;
  22. /** should this be verbose in its output */
  23. void SetVerbose(bool verb) { this->Verbose = verb; }
  24. /** Set the local generator for the directory in which we are
  25. scanning dependencies. This is not a full local generator; it
  26. has been setup to do relative path conversions for the current
  27. directory. */
  28. void SetLocalGenerator(cmLocalUnixMakefileGenerator3* lg)
  29. {
  30. this->LocalGenerator = lg;
  31. }
  32. /** Read dependencies for the target file. Return true if
  33. dependencies didn't changed and false if not.
  34. Up-to-date Dependencies will be stored in deps. */
  35. bool CheckDependencies(
  36. const std::string& internalDepFile,
  37. const std::vector<std::string>& depFiles,
  38. cmDepends::DependencyMap& dependencies,
  39. const std::function<bool(const std::string&)>& isValidPath);
  40. /** Write dependencies for the target file. */
  41. void WriteDependencies(const cmDepends::DependencyMap& dependencies,
  42. std::ostream& makeDepends,
  43. std::ostream& internalDepends);
  44. /** Clear dependencies for the target so they will be regenerated. */
  45. void ClearDependencies(const std::vector<std::string>& depFiles);
  46. private:
  47. bool Verbose = false;
  48. cmLocalUnixMakefileGenerator3* LocalGenerator = nullptr;
  49. };