1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMakeDepend.h,v $
6 Date: $Date: 2006/05/12 16:29:09 $
7 Version: $Revision: 1.24 $
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 * Get the depend info struct for a source file
102 const cmDependInformation
103 *GetDependInformationForSourceFile(const cmSourceFile
&sf
) const;
106 * Add a directory to the search path for include files.
108 virtual void AddSearchPath(const char*);
111 * Generate dependencies for all the sources of all the targets
114 void GenerateMakefileDependencies();
117 * Generate dependencies for the file given. Returns a pointer to
118 * the cmDependInformation object for the file.
120 const cmDependInformation
* FindDependencies(const char* file
);
124 * Add a source file to the search path.
126 void AddFileToSearchPath(const char* filepath
);
129 * Compute the depend information for this class.
131 virtual void DependWalk(cmDependInformation
* info
);
134 * Add a dependency. Possibly walk it for more dependencies.
136 virtual void AddDependency(cmDependInformation
* info
, const char* file
);
139 * Fill in the given object with dependency information. If the
140 * information is already complete, nothing is done.
142 void GenerateDependInformation(cmDependInformation
* info
);
145 * Get an instance of cmDependInformation corresponding to the given file
148 cmDependInformation
* GetDependInformation(const char* file
,
149 const char *extraPath
);
152 * Find the full path name for the given file name.
153 * This uses the include directories.
154 * TODO: Cache path conversions to reduce FileExists calls.
156 std::string
FullPath(const char *filename
, const char *extraPath
);
158 cmMakefile
* Makefile
;
160 cmsys::RegularExpression IncludeFileRegularExpression
;
161 cmsys::RegularExpression ComplainFileRegularExpression
;
162 std::vector
<std::string
> IncludeDirectories
;
163 typedef std::map
<cmStdString
, cmStdString
> FileToPathMapType
;
164 typedef std::map
<cmStdString
, FileToPathMapType
>
165 DirectoryToFileToPathMapType
;
166 typedef std::map
<cmStdString
, cmDependInformation
*>
167 DependInformationMapType
;
168 DependInformationMapType DependInformationMap
;
169 DirectoryToFileToPathMapType DirectoryToFileToPathMap
;