Introduce "generator expressions" to add_test()
[cmake.git] / Source / cmMakeDepend.h
blob87a6b6647c1f2cc1826feb3af5a4685661eee1a6
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMakeDepend.h,v $
5 Language: C++
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
32 public:
33 /**
34 * Construct with dependency generation marked not done; instance
35 * not placed in cmMakefile's list.
37 cmDependInformation(): DependDone(false), SourceFile(0) {}
39 /**
40 * The set of files on which this one depends.
42 typedef std::set<cmDependInformation*> DependencySetType;
43 DependencySetType DependencySet;
45 /**
46 * This flag indicates whether dependency checking has been
47 * performed for this file.
49 bool DependDone;
51 /**
52 * If this object corresponds to a cmSourceFile instance, this points
53 * to it.
55 const cmSourceFile *SourceFile;
57 /**
58 * Full path to this file.
60 std::string FullPath;
62 /**
63 * Full path not including file name.
65 std::string PathOnly;
67 /**
68 * Name used to #include this file.
70 std::string IncludeName;
72 /**
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
81 class cmMakeDepend
83 public:
84 /**
85 * Construct the object with verbose turned off.
87 cmMakeDepend();
89 /**
90 * Destructor.
92 virtual ~cmMakeDepend();
94 /**
95 * Set the makefile that is used as a source of classes.
97 virtual void SetMakefile(cmMakefile* makefile);
99 /**
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);
110 protected:
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
129 * name.
131 cmDependInformation* GetDependInformation(const char* file,
132 const char *extraPath);
134 /**
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;
142 bool Verbose;
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;
155 #endif