1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMakeDepend.h,v $
6 Date: $Date: 2009-03-16 18:30:19 $
7 Version: $Revision: 1.25 $
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 =========================================================================*/
17 #ifndef cmMakeDepend_h
18 #define cmMakeDepend_h
20 #include "cmMakefile.h"
21 #include "cmSourceFile.h"
23 #include <cmsys/RegularExpression.hxx>
25 /** \class cmDependInformation
26 * \brief Store dependency information for a single source file.
28 * This structure stores the depend information for a single source file.
30 class cmDependInformation
34 * Construct with dependency generation marked not done; instance
35 * not placed in cmMakefile's list.
37 cmDependInformation(): DependDone(false), SourceFile(0) {}
40 * The set of files on which this one depends.
42 typedef std::set
<cmDependInformation
*> DependencySetType
;
43 DependencySetType DependencySet
;
46 * This flag indicates whether dependency checking has been
47 * performed for this file.
52 * If this object corresponds to a cmSourceFile instance, this points
55 const cmSourceFile
*SourceFile
;
58 * Full path to this file.
63 * Full path not including file name.
68 * Name used to #include this file.
70 std::string IncludeName
;
73 * This method adds the dependencies of another file to this one.
75 void AddDependencies(cmDependInformation
*);
79 // cmMakeDepend is used to generate dependancy information for
80 // the classes in a makefile
85 * Construct the object with verbose turned off.
92 virtual ~cmMakeDepend();
95 * Set the makefile that is used as a source of classes.
97 virtual void SetMakefile(cmMakefile
* makefile
);
100 * Add a directory to the search path for include files.
102 virtual void AddSearchPath(const char*);
105 * Generate dependencies for the file given. Returns a pointer to
106 * the cmDependInformation object for the file.
108 const cmDependInformation
* FindDependencies(const char* file
);
112 * Compute the depend information for this class.
114 virtual void DependWalk(cmDependInformation
* info
);
117 * Add a dependency. Possibly walk it for more dependencies.
119 virtual void AddDependency(cmDependInformation
* info
, const char* file
);
122 * Fill in the given object with dependency information. If the
123 * information is already complete, nothing is done.
125 void GenerateDependInformation(cmDependInformation
* info
);
128 * Get an instance of cmDependInformation corresponding to the given file
131 cmDependInformation
* GetDependInformation(const char* file
,
132 const char *extraPath
);
135 * Find the full path name for the given file name.
136 * This uses the include directories.
137 * TODO: Cache path conversions to reduce FileExists calls.
139 std::string
FullPath(const char *filename
, const char *extraPath
);
141 cmMakefile
* Makefile
;
143 cmsys::RegularExpression IncludeFileRegularExpression
;
144 cmsys::RegularExpression ComplainFileRegularExpression
;
145 std::vector
<std::string
> IncludeDirectories
;
146 typedef std::map
<cmStdString
, cmStdString
> FileToPathMapType
;
147 typedef std::map
<cmStdString
, FileToPathMapType
>
148 DirectoryToFileToPathMapType
;
149 typedef std::map
<cmStdString
, cmDependInformation
*>
150 DependInformationMapType
;
151 DependInformationMapType DependInformationMap
;
152 DirectoryToFileToPathMapType DirectoryToFileToPathMap
;