summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.h
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-01-05 16:41:20 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-01-05 16:41:20 (GMT)
commitc54a05bfc799f3e88459956ec37698bab22c27f9 (patch)
tree400b2eb0b6853952a4faa8c0fc41b90eb06deaec /Source/cmMakefile.h
parentd888b5e39d4e01af538b48ad16c2a6a474de34a0 (diff)
downloadCMake-c54a05bfc799f3e88459956ec37698bab22c27f9.zip
CMake-c54a05bfc799f3e88459956ec37698bab22c27f9.tar.gz
CMake-c54a05bfc799f3e88459956ec37698bab22c27f9.tar.bz2
ENH: rework cmake, added ruleMaker classes and changed the syntax of the CMakeLists.txt files.
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r--Source/cmMakefile.h131
1 files changed, 104 insertions, 27 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 6541cff..c377e90 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -19,28 +19,52 @@
*/
#ifndef cmMakefile_h
#define cmMakefile_h
-#ifdef _MSC_VER
-#pragma warning ( disable : 4786 )
-#endif
-
+#include "cmStandardIncludes.h"
#include "cmClassFile.h"
-#include "cmCollectFlags.h"
-#include <vector>
-#include <fstream>
-#include <iostream>
+#include "cmSystemTools.h"
+class cmRuleMaker;
+class cmMakefileGenerator;
+
class cmMakefile
{
public:
cmMakefile();
- // Parse a Makfile.in file
- bool ReadMakefile(const char* makefile);
+ ~cmMakefile();
+ // Parse a CMakeLists.txt file
+ bool ReadMakefile(const char* makefile, bool inheriting = false);
+ // Add a wrap generator
+ void AddRuleMaker(cmRuleMaker* );
+ // Set the make file
+ void SetMakefileGenerator(cmMakefileGenerator*);
+ // Generate the output file
+ void GenerateMakefile();
+
// Print useful stuff to stdout
void Print();
+
+ // cmRuleMaker interfaces
+ void AddCustomRule(const char* source,
+ const char* result,
+ const char* command,
+ std::vector<std::string>& depends);
+ void AddDefineFlag(const char* definition);
+ void AddExecutable(cmClassFile&);
+ void AddLinkLibrary(const char*);
+ void AddLinkDirectory(const char*);
+ void AddSubDirectory(const char*);
+ void AddIncludeDirectory(const char*);
+ void AddDefinition(const char* name, const char* value);
+ void SetProjectName(const char*);
+ void SetLibraryName(const char*);
+ void AddClass(cmClassFile& );
+ void AddExtraDirectory(const char* dir);
+
// Set the home directory for the project
void SetHomeDirectory(const char* dir)
{
m_cmHomeDirectory = dir;
+ cmSystemTools::ConvertToUnixSlashes(m_cmHomeDirectory);
}
const char* GetHomeDirectory()
{
@@ -56,19 +80,11 @@ public:
return m_cmCurrentDirectory.c_str();
}
// Set the name of the library that is built by this makefile
- void SetLibraryName(const char* lib)
- {
- m_LibraryName = lib;
- }
const char* GetLibraryName()
{
return m_LibraryName.c_str();
}
- // Set the name of the library that is built by this makefile
- void SetProjectName(const char* lib)
- {
- m_ProjectName = lib;
- }
+
const char* GetProjectName()
{
return m_ProjectName.c_str();
@@ -93,10 +109,6 @@ public:
{
return m_OutputHomeDirectory.c_str();
}
- cmCollectFlags& GetBuildFlags()
- {
- return m_BuildFlags;
- }
const std::vector<std::string>& GetSubDirectories()
{
return m_SubDirectories;
@@ -107,15 +119,60 @@ public:
return m_Executables;
}
+ std::vector<std::string>& GetIncludeDirectories()
+ {
+ return m_IncludeDirectories;
+ }
+
+ std::vector<std::string>& GetLinkDirectories()
+ {
+ return m_LinkDirectories;
+ }
+
+ std::vector<std::string>& GetLinkLibraries()
+ {
+ return m_LinkLibraries;
+ }
+
+ std::vector<std::string>& GetLinkLibrariesWin32()
+ {
+ return m_LinkLibrariesWin32;
+ }
+
+ std::vector<std::string>& GetLinkLibrariesUnix()
+ {
+ return m_LinkLibrariesUnix;
+ }
+ std::vector<cmClassFile>& GetClasses(){ return m_Classes;}
+ std::vector<std::string>& GetAuxSourceDirectories()
+ { return m_AuxSourceDirectories; }
+ std::vector<std::string>& GetMakeVerbatim()
+ { return m_MakeVerbatim;}
+ const char* GetDefinition(const char*);
+
+ const char* GetDefineFlags()
+ { return m_DefineFlags.c_str();}
+
private:
- void ReadTemplateInstanceDirectory(std::string&);
+ /**
+ * Look for CMakeLists.txt files to parse in dir,
+ * then in dir's parents, until the SourceHome directory
+ * is found.
+ */
+ void ParseDirectory(const char* dir);
+ /**
+ * Parse a file for includes links and libs
+ */
+ void ExpandVaribles();
void ReadClasses(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access
- // to the m_Classes array
+ // to the m_Classes array
+ void PrintStringVector(const char* s, std::vector<std::string>& v);
+ void AddDefaultRules();
protected:
bool m_Executables;
std::string m_Prefix;
- std::vector<std::string> m_TemplateDirectories; // Template directory name if found in file
+ std::vector<std::string> m_AuxSourceDirectories; //
std::string m_OutputDirectory; // Current output directory for makefile
std::string m_OutputHomeDirectory; // Top level output directory
std::string m_cmHomeDirectory; // Home directory for source
@@ -125,7 +182,27 @@ protected:
std::vector<cmClassFile> m_Classes; // list of classes in makefile
std::vector<std::string> m_SubDirectories; // list of sub directories
std::vector<std::string> m_MakeVerbatim; // lines copied from input file
- cmCollectFlags m_BuildFlags;
+ std::vector<std::string> m_IncludeDirectories;
+ std::vector<std::string> m_LinkDirectories;
+ std::vector<std::string> m_LinkLibraries;
+ std::vector<std::string> m_LinkLibrariesWin32;
+ std::vector<std::string> m_LinkLibrariesUnix;
+ std::string m_DefineFlags;
+ std::string m_SourceHomeDirectory;
+ struct customRule
+ {
+ std::string m_Source;
+ std::string m_Result;
+ std::string m_Command;
+ std::vector<std::string> m_Depends;
+ };
+ std::vector<customRule> m_CustomRules;
+ typedef std::map<std::string, cmRuleMaker*> StringRuleMakerMap;
+ typedef std::map<std::string, std::string> DefinitionMap;
+ DefinitionMap m_Definitions;
+ StringRuleMakerMap m_RuleMakers;
+ std::vector<cmRuleMaker*> m_UsedRuleMakers;
+ cmMakefileGenerator* m_MakefileGenerator;
};