Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmDepends.h
blobc03c0951b7648ed954cf2d0ead607ce4719af236
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDepends.h,v $
5 Language: C++
6 <<<<<<< cmDepends.h
7 Date: $Date: 2007/12/28 16:49:59 $
8 Version: $Revision: 1.14 $
9 =======
10 Date: $Date: 2008-05-08 14:09:14 $
11 Version: $Revision: 1.15 $
12 >>>>>>> 1.15
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #ifndef cmDepends_h
23 #define cmDepends_h
25 #include "cmStandardIncludes.h"
27 class cmFileTimeComparison;
28 class cmLocalGenerator;
30 /** \class cmDepends
31 * \brief Dependency scanner superclass.
33 * This class is responsible for maintaining a .depends.make file in
34 * the build tree corresponding to an object file. Subclasses help it
35 * maintain dependencies for particular languages.
37 class cmDepends
39 public:
40 /** Instances need to know the build directory name and the relative
41 path from the build directory to the target file. */
42 cmDepends(cmLocalGenerator* lg=0, const char* targetDir="");
44 /** at what level will the compile be done from */
45 void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;};
47 /** Set the local generator for the directory in which we are
48 scanning dependencies. This is not a full local generator; it
49 has been setup to do relative path conversions for the current
50 directory. */
51 void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; }
53 /** Set the specific language to be scanned. */
54 void SetLanguage(const char* lang) { this->Language = lang; }
56 /** Set the target build directory. */
57 void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; }
59 /** should this be verbose in its output */
60 void SetVerbose(bool verb) { this->Verbose = verb; }
62 /** Virtual destructor to cleanup subclasses properly. */
63 virtual ~cmDepends();
65 /** Write dependencies for the target file. */
66 bool Write(std::ostream &makeDepends, std::ostream &internalDepends);
68 /** Check dependencies for the target file. Returns true if
69 dependencies are okay and false if they must be generated. If
70 they must be generated Clear has already been called to wipe out
71 the old dependencies. */
72 bool Check(const char *makeFile, const char* internalFile);
74 /** Clear dependencies for the target file so they will be regenerated. */
75 void Clear(const char *file);
77 /** Set the file comparison object */
78 void SetFileComparison(cmFileTimeComparison* fc) {
79 this->FileComparison = fc; }
81 protected:
83 // Write dependencies for the target file to the given stream.
84 // Return true for success and false for failure.
85 virtual bool WriteDependencies(const char *src, const char* obj,
86 std::ostream& makeDepends, std::ostream& internalDepends);
88 // Check dependencies for the target file in the given stream.
89 // Return false if dependencies must be regenerated and true
90 // otherwise.
91 virtual bool CheckDependencies(std::istream& internalDepends);
93 // Finalize the dependency information for the target.
94 virtual bool Finalize(std::ostream& makeDepends,
95 std::ostream& internalDepends);
97 // The directory in which the build rule for the target file is executed.
98 std::string CompileDirectory;
100 // The local generator.
101 cmLocalGenerator* LocalGenerator;
103 // Flag for verbose output.
104 bool Verbose;
105 cmFileTimeComparison* FileComparison;
107 std::string Language;
109 // The full path to the target's build directory.
110 std::string TargetDirectory;
112 size_t MaxPath;
113 char* Dependee;
114 char* Depender;
116 // The include file search path.
117 std::vector<std::string> IncludePath;
119 void SetIncludePathFromLanguage(const char* lang);
121 private:
122 cmDepends(cmDepends const&); // Purposely not implemented.
123 void operator=(cmDepends const&); // Purposely not implemented.
126 #endif