1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #ifndef cmMakeDepend_h
13 #define cmMakeDepend_h
15 #include "cmMakefile.h"
16 #include "cmSourceFile.h"
18 #include <cmsys/RegularExpression.hxx>
20 /** \class cmDependInformation
21 * \brief Store dependency information for a single source file.
23 * This structure stores the depend information for a single source file.
25 class cmDependInformation
29 * Construct with dependency generation marked not done; instance
30 * not placed in cmMakefile's list.
32 cmDependInformation(): DependDone(false), SourceFile(0) {}
35 * The set of files on which this one depends.
37 typedef std::set<cmDependInformation*> DependencySetType;
38 DependencySetType DependencySet;
41 * This flag indicates whether dependency checking has been
42 * performed for this file.
47 * If this object corresponds to a cmSourceFile instance, this points
50 const cmSourceFile *SourceFile;
53 * Full path to this file.
58 * Full path not including file name.
63 * Name used to #include this file.
65 std::string IncludeName;
68 * This method adds the dependencies of another file to this one.
70 void AddDependencies(cmDependInformation*);
74 // cmMakeDepend is used to generate dependancy information for
75 // the classes in a makefile
80 * Construct the object with verbose turned off.
87 virtual ~cmMakeDepend();
90 * Set the makefile that is used as a source of classes.
92 virtual void SetMakefile(cmMakefile* makefile);
95 * Add a directory to the search path for include files.
97 virtual void AddSearchPath(const char*);
100 * Generate dependencies for the file given. Returns a pointer to
101 * the cmDependInformation object for the file.
103 const cmDependInformation* FindDependencies(const char* file);
107 * Compute the depend information for this class.
109 virtual void DependWalk(cmDependInformation* info);
112 * Add a dependency. Possibly walk it for more dependencies.
114 virtual void AddDependency(cmDependInformation* info, const char* file);
117 * Fill in the given object with dependency information. If the
118 * information is already complete, nothing is done.
120 void GenerateDependInformation(cmDependInformation* info);
123 * Get an instance of cmDependInformation corresponding to the given file
126 cmDependInformation* GetDependInformation(const char* file,
127 const char *extraPath);
130 * Find the full path name for the given file name.
131 * This uses the include directories.
132 * TODO: Cache path conversions to reduce FileExists calls.
134 std::string FullPath(const char *filename, const char *extraPath);
136 cmMakefile* Makefile;
138 cmsys::RegularExpression IncludeFileRegularExpression;
139 cmsys::RegularExpression ComplainFileRegularExpression;
140 std::vector<std::string> IncludeDirectories;
141 typedef std::map<cmStdString, cmStdString> FileToPathMapType;
142 typedef std::map<cmStdString, FileToPathMapType>
143 DirectoryToFileToPathMapType;
144 typedef std::map<cmStdString, cmDependInformation*>
145 DependInformationMapType;
146 DependInformationMapType DependInformationMap;
147 DirectoryToFileToPathMapType DirectoryToFileToPathMap;