diff options
author | Ken Martin <ken.martin@kitware.com> | 2005-05-11 17:16:45 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2005-05-11 17:16:45 (GMT) |
commit | c85069b290922572f9ef15a06ec1d0d0be3adaaa (patch) | |
tree | 8ba1f7b378a0295cea5f550cd8fcb76cb676985e /Source | |
parent | 25d6c04add53631d6506674c3584fc0d8a6e0d46 (diff) | |
download | CMake-c85069b290922572f9ef15a06ec1d0d0be3adaaa.zip CMake-c85069b290922572f9ef15a06ec1d0d0be3adaaa.tar.gz CMake-c85069b290922572f9ef15a06ec1d0d0be3adaaa.tar.bz2 |
ENH: some changes to the depends signature to be more flexible
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDepends.cxx | 31 | ||||
-rw-r--r-- | Source/cmDepends.h | 11 | ||||
-rw-r--r-- | Source/cmDependsC.cxx | 13 | ||||
-rw-r--r-- | Source/cmDependsC.h | 9 | ||||
-rw-r--r-- | Source/cmDependsFortran.cxx | 8 | ||||
-rw-r--r-- | Source/cmDependsFortran.h | 5 | ||||
-rw-r--r-- | Source/cmDependsJava.cxx | 8 | ||||
-rw-r--r-- | Source/cmDependsJava.h | 5 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator2.cxx | 23 |
9 files changed, 60 insertions, 53 deletions
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index d2375fd..9544662 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -22,27 +22,34 @@ #include <assert.h> //---------------------------------------------------------------------------- -cmDepends::cmDepends(const char* dir, const char* targetFile, bool verbose): - m_Directory(dir), - m_TargetFile(targetFile), - m_DependsMakeFile(dir), - m_DependsMarkFile(dir), - m_Verbose(verbose) +cmDepends::cmDepends() { + m_Verbose = false; +} + +//---------------------------------------------------------------------------- +cmDepends::~cmDepends() +{ +} + +void cmDepends::SetTargetFile(const char* dir, const char* targetFile, + const char *markExt, const char *makeExt) +{ + m_Directory = dir; + m_TargetFile = targetFile; + // Construct the path to the make and mark files. Append // appropriate extensions to their names. + m_DependsMarkFile = dir; + m_DependsMakeFile = dir; m_DependsMakeFile += "/"; m_DependsMarkFile += "/"; m_DependsMakeFile += m_TargetFile; m_DependsMarkFile += m_TargetFile; - m_DependsMakeFile += ".depends.make"; - m_DependsMarkFile += ".depends"; + m_DependsMakeFile += makeExt; + m_DependsMarkFile += markExt; } -//---------------------------------------------------------------------------- -cmDepends::~cmDepends() -{ -} //---------------------------------------------------------------------------- bool cmDepends::Write() diff --git a/Source/cmDepends.h b/Source/cmDepends.h index f48c325..b9e3f99 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -31,8 +31,15 @@ class cmDepends public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDepends(const char* dir, const char* targetFile, bool verbose); - + cmDepends(); + + /** set the name directory and extensions of the target file to scan */ + void SetTargetFile(const char* dir, const char* targetFile, + const char *markExt, const char *makeExt); + + /** should this be verbose in its output */ + void SetVerbose(bool verb) { m_Verbose = verb; } + /** Virtual destructor to cleanup subclasses properly. */ virtual ~cmDepends(); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 6e359a5..71d4598 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -21,22 +21,15 @@ #include <ctype.h> // isspace //---------------------------------------------------------------------------- -cmDependsC::cmDependsC(const char* dir, const char* targetFile, bool verbose): - cmDepends(dir, targetFile, verbose), - m_SourceFile(), - m_IncludePath(0), - m_IncludeRegexLine(), - m_IncludeRegexScan(), - m_IncludeRegexComplain() +cmDependsC::cmDependsC() { } //---------------------------------------------------------------------------- -cmDependsC::cmDependsC(const char* dir, const char* targetFile, - const char* sourceFile, +// yummy look at all those constructor arguments +cmDependsC::cmDependsC(const char* sourceFile, std::vector<std::string> const& includes, const char* scanRegex, const char* complainRegex): - cmDepends(dir, targetFile, false), m_SourceFile(sourceFile), m_IncludePath(&includes), m_IncludeRegexLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)([\">])"), diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index 0a0bc36..2f16d77 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -29,14 +29,15 @@ class cmDependsC: public cmDepends public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDependsC(const char* dir, const char* targetFile, bool verbose); + cmDependsC(); /** Scanning need to know the build directory name, the relative path from the build directory to the target file, the source file from which to start scanning, and the include file search - path. It also uses the include file regular expressions. */ - cmDependsC(const char* dir, const char* targetFile, - const char* sourceFile, std::vector<std::string> const& includes, + path. It also uses the include file regular expressions. + This is a good example of why constructors should not take arguments. + */ + cmDependsC(const char* sourceFile, std::vector<std::string> const& includes, const char* scanRegex, const char* complainRegex); /** Virtual destructor to cleanup subclasses properly. */ diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index f063f29..ca2d388 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -76,19 +76,15 @@ struct cmDependsFortranParser_s }; //---------------------------------------------------------------------------- -cmDependsFortran::cmDependsFortran(const char* dir, const char* targetFile, - bool verbose): - cmDepends(dir, targetFile, verbose), +cmDependsFortran::cmDependsFortran(): m_SourceFile(), m_IncludePath(0) { } //---------------------------------------------------------------------------- -cmDependsFortran::cmDependsFortran(const char* dir, const char* targetFile, - const char* sourceFile, +cmDependsFortran::cmDependsFortran(const char* sourceFile, std::vector<std::string> const& includes): - cmDepends(dir, targetFile, false), m_SourceFile(sourceFile), m_IncludePath(&includes) { diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 8b09005..98db772 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -27,14 +27,13 @@ class cmDependsFortran: public cmDepends public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDependsFortran(const char* dir, const char* targetFile, bool verbose); + cmDependsFortran(); /** Scanning need to know the build directory name, the relative path from the build directory to the target file, the source file from which to start scanning, and the include file search path. */ - cmDependsFortran(const char* dir, const char* targetFile, - const char* sourceFile, std::vector<std::string> const& includes); + cmDependsFortran(const char* sourceFile, std::vector<std::string> const& includes); /** Virtual destructor to cleanup subclasses properly. */ virtual ~cmDependsFortran(); diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index bf1ff21..ae4e525 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -20,17 +20,13 @@ #include "cmSystemTools.h" //---------------------------------------------------------------------------- -cmDependsJava::cmDependsJava(const char* dir, const char* targetFile, - bool verbose): - cmDepends(dir, targetFile, verbose), +cmDependsJava::cmDependsJava(): m_SourceFile() { } //---------------------------------------------------------------------------- -cmDependsJava::cmDependsJava(const char* dir, const char* targetFile, - const char* sourceFile): - cmDepends(dir, targetFile, false), +cmDependsJava::cmDependsJava(const char* sourceFile): m_SourceFile(sourceFile) { } diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 579dad2..69466fc 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -27,13 +27,12 @@ class cmDependsJava: public cmDepends public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDependsJava(const char* dir, const char* targetFile, bool verbose); + cmDependsJava(); /** Scanning need to know the build directory name, the relative path from the build directory to the target file and the source file to scan. */ - cmDependsJava(const char* dir, const char* targetFile, - const char* sourceFile); + cmDependsJava(const char* sourceFile); /** Virtual destructor to cleanup subclasses properly. */ virtual ~cmDependsJava(); diff --git a/Source/cmLocalUnixMakefileGenerator2.cxx b/Source/cmLocalUnixMakefileGenerator2.cxx index bf2a3c5..4a8f6e2 100644 --- a/Source/cmLocalUnixMakefileGenerator2.cxx +++ b/Source/cmLocalUnixMakefileGenerator2.cxx @@ -3102,21 +3102,27 @@ cmLocalUnixMakefileGenerator2::GetDependsChecker(const std::string& lang, const char* objFile, bool verbose) { + cmDepends *ret = 0; if(lang == "C" || lang == "CXX" || lang == "RC") { - return new cmDependsC(dir, objFile, verbose); + ret = new cmDependsC(); } #ifdef CMAKE_BUILD_WITH_CMAKE else if(lang == "Fortran") { - return new cmDependsFortran(dir, objFile, verbose); + ret = new cmDependsFortran(); } else if(lang == "Java") { - return new cmDependsJava(dir, objFile, verbose); + ret = new cmDependsJava(); } #endif - return 0; + if (ret) + { + ret->SetTargetFile(dir, objFile, ".depends",".depends.make"); + ret->SetVerbose(verbose); + } + return ret; } //---------------------------------------------------------------------------- @@ -3201,19 +3207,22 @@ cmLocalUnixMakefileGenerator2 if(lang == "C" || lang == "CXX" || lang == "RC") { // TODO: Handle RC (resource files) dependencies correctly. - cmDependsC scanner(".", objFile, srcFile, includes, + cmDependsC scanner(srcFile, includes, includeRegexScan.c_str(), includeRegexComplain.c_str()); + scanner.SetTargetFile(".",objFile,".depends",".depends.make"); return scanner.Write(); } #ifdef CMAKE_BUILD_WITH_CMAKE else if(lang == "Fortran") { - cmDependsFortran scanner(".", objFile, srcFile, includes); + cmDependsFortran scanner(srcFile, includes); + scanner.SetTargetFile(".",objFile,".depends",".depends.make"); return scanner.Write(); } else if(lang == "Java") { - cmDependsJava scanner(".", objFile, srcFile); + cmDependsJava scanner(srcFile); + scanner.SetTargetFile(".",objFile,".depends",".depends.make"); return scanner.Write(); } #endif |