1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDependsC.h,v $
6 Date: $Date: 2007-02-05 14:48:38 $
7 Version: $Revision: 1.20 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
20 #include "cmDepends.h"
21 #include <cmsys/RegularExpression.hxx>
25 * \brief Dependency scanner for C and C++ object files.
27 class cmDependsC
: public cmDepends
30 /** Checking instances need to know the build directory name and the
31 relative path from the build directory to the target file. */
33 cmDependsC(std::vector
<std::string
> const& includes
,
34 const char* scanRegex
, const char* complainRegex
,
35 const cmStdString
& cachFileName
);
37 /** Virtual destructor to cleanup subclasses properly. */
38 virtual ~cmDependsC();
41 typedef std::vector
<char> t_CharBuffer
;
43 // Implement writing/checking methods required by superclass.
44 virtual bool WriteDependencies(const char *src
,
46 std::ostream
& makeDepends
,
47 std::ostream
& internalDepends
);
49 // Method to scan a single file.
50 void Scan(std::istream
& is
, const char* directory
,
51 const cmStdString
& fullName
);
53 // The include file search path.
54 std::vector
<std::string
> const* IncludePath
;
56 // Regular expression to identify C preprocessor include directives.
57 cmsys::RegularExpression IncludeRegexLine
;
59 // Regular expressions to choose which include files to scan
60 // recursively and which to complain about not finding.
61 cmsys::RegularExpression IncludeRegexScan
;
62 cmsys::RegularExpression IncludeRegexComplain
;
63 const std::string IncludeRegexLineString
;
64 const std::string IncludeRegexScanString
;
65 const std::string IncludeRegexComplainString
;
68 // Data structures for dependency graph walk.
72 cmStdString QuotedLocation
;
77 cmIncludeLines(): Used(false) {}
78 std::vector
<UnscannedEntry
> UnscannedEntries
;
82 std::set
<cmStdString
> Encountered
;
83 std::queue
<UnscannedEntry
> Unscanned
;
86 std::map
<cmStdString
, cmIncludeLines
*> FileCache
;
87 std::map
<cmStdString
, cmStdString
> HeaderLocationCache
;
89 cmStdString CacheFileName
;
91 void WriteCacheFile() const;
94 cmDependsC(cmDependsC
const&); // Purposely not implemented.
95 void operator=(cmDependsC
const&); // Purposely not implemented.