cmDependsC.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 cmDependsC_h
  14. #define cmDependsC_h
  15. #include "cmDepends.h"
  16. #include <cmsys/RegularExpression.hxx>
  17. #include <queue>
  18. /** \class cmDependsC
  19. * \brief Dependency scanner for C and C++ object files.
  20. */
  21. class cmDependsC: public cmDepends
  22. {
  23. public:
  24. /** Checking instances need to know the build directory name and the
  25. relative path from the build directory to the target file. */
  26. cmDependsC(const char* dir, const char* targetFile);
  27. /** Scanning need to know the build directory name, the relative
  28. path from the build directory to the target file, the source
  29. file from which to start scanning, and the include file search
  30. path. */
  31. cmDependsC(const char* dir, const char* targetFile,
  32. const char* sourceFile, std::vector<std::string> const& includes);
  33. /** Virtual destructor to cleanup subclasses properly. */
  34. virtual ~cmDependsC();
  35. protected:
  36. // Implement writing/checking methods required by superclass.
  37. virtual bool WriteDependencies(std::ostream& os);
  38. virtual bool CheckDependencies(std::istream& is);
  39. // Method to scan a single file.
  40. void Scan(std::istream& is);
  41. // The source file from which to start scanning.
  42. std::string m_SourceFile;
  43. // The include file search path.
  44. std::vector<std::string> const* m_IncludePath;
  45. // Regular expression to identify C preprocessor include directives.
  46. cmsys::RegularExpression m_IncludeLineRegex;
  47. // Data structures for dependency graph walk.
  48. std::set<cmStdString> m_Encountered;
  49. std::queue<cmStdString> m_Unscanned;
  50. private:
  51. cmDependsC(cmDependsC const&); // Purposely not implemented.
  52. void operator=(cmDependsC const&); // Purposely not implemented.
  53. };
  54. #endif