summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-07-08 01:52:10 (GMT)
committerBrad King <brad.king@kitware.com>2003-07-08 01:52:10 (GMT)
commite5ed57ec18e1cd1d460bd77391db15a5d4afdcc1 (patch)
tree1a6c2c3b22eb90c0dfd647e08b05aea8f603f439 /Source/cmake.cxx
parentcbb1de923a3fb977f3910d4054191cdffc478134 (diff)
downloadCMake-e5ed57ec18e1cd1d460bd77391db15a5d4afdcc1.zip
CMake-e5ed57ec18e1cd1d460bd77391db15a5d4afdcc1.tar.gz
CMake-e5ed57ec18e1cd1d460bd77391db15a5d4afdcc1.tar.bz2
ENH: Registered global generators are now kept in a table in the cmake instance. Added support for documentation with a Generators section.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx101
1 files changed, 51 insertions, 50 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 22e747f..f073271 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -94,6 +94,7 @@ cmake::cmake()
m_ProgressCallbackClientData = 0;
m_VariableWatch = new cmVariableWatch;
+ this->AddDefaultGenerators();
this->AddDefaultCommands();
m_VariableWatch->AddWatch("CMAKE_WORDS_BIGENDIAN",
@@ -662,64 +663,26 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
{
-#if defined(_WIN32) && !defined(__CYGWIN__)
- names.push_back(cmGlobalVisualStudio6Generator::GetActualName());
- names.push_back(cmGlobalVisualStudio7Generator::GetActualName());
- names.push_back(cmGlobalVisualStudio71Generator::GetActualName());
- names.push_back(cmGlobalBorlandMakefileGenerator::GetActualName());
- names.push_back(cmGlobalNMakeMakefileGenerator::GetActualName());
-#else
-#if defined(__APPLE__) && defined(CMAKE_BUILD_WITH_CMAKE)
- names.push_back(cmGlobalCodeWarriorGenerator::GetActualName());
-#endif
- names.push_back(cmGlobalUnixMakefileGenerator::GetActualName());
-#endif
+ for(RegisteredGeneratorsMap::const_iterator i = m_Generators.begin();
+ i != m_Generators.end(); ++i)
+ {
+ names.push_back(i->first);
+ }
}
cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
{
- cmGlobalGenerator *ret = 0;
-#if defined(_WIN32) && !defined(__CYGWIN__)
- if (!strcmp(name,cmGlobalNMakeMakefileGenerator::GetActualName()))
+ RegisteredGeneratorsMap::const_iterator i = m_Generators.find(name);
+ if(i != m_Generators.end())
{
- ret = new cmGlobalNMakeMakefileGenerator;
- ret->SetCMakeInstance(this);
+ cmGlobalGenerator* generator = (i->second)();
+ generator->SetCMakeInstance(this);
+ return generator;
}
- if (!strcmp(name,cmGlobalVisualStudio6Generator::GetActualName()))
- {
- ret = new cmGlobalVisualStudio6Generator;
- ret->SetCMakeInstance(this);
- }
- if (!strcmp(name,cmGlobalVisualStudio7Generator::GetActualName()))
- {
- ret = new cmGlobalVisualStudio7Generator;
- ret->SetCMakeInstance(this);
- }
- if (!strcmp(name,cmGlobalVisualStudio71Generator::GetActualName()))
- {
- ret = new cmGlobalVisualStudio71Generator;
- ret->SetCMakeInstance(this);
- }
- if (!strcmp(name,cmGlobalBorlandMakefileGenerator::GetActualName()))
- {
- ret = new cmGlobalBorlandMakefileGenerator;
- ret->SetCMakeInstance(this);
- }
-#else
-#if defined(__APPLE__) && defined(CMAKE_BUILD_WITH_CMAKE)
- if (!strcmp(name,cmGlobalCodeWarriorGenerator::GetActualName()))
- {
- ret = new cmGlobalCodeWarriorGenerator;
- ret->SetCMakeInstance(this);
- }
-#endif
- if (!strcmp(name,cmGlobalUnixMakefileGenerator::GetActualName()))
+ else
{
- ret = new cmGlobalUnixMakefileGenerator;
- ret->SetCMakeInstance(this);
+ return 0;
}
-#endif
- return ret;
}
void cmake::SetHomeDirectory(const char* dir)
@@ -1126,6 +1089,29 @@ void cmake::AddDefaultCommands()
}
}
+void cmake::AddDefaultGenerators()
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ m_Generators[cmGlobalVisualStudio6Generator::GetActualName()] =
+ &cmGlobalVisualStudio6Generator::New;
+ m_Generators[cmGlobalVisualStudio7Generator::GetActualName()] =
+ &cmGlobalVisualStudio7Generator::New;
+ m_Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
+ &cmGlobalVisualStudio71Generator::New;
+ m_Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] =
+ &cmGlobalBorlandMakefileGenerator::New;
+ m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
+ &cmGlobalNMakeMakefileGenerator::New;
+#else
+# if defined(__APPLE__) && defined(CMAKE_BUILD_WITH_CMAKE)
+ m_Generators[cmGlobalCodeWarriorGenerator::GetActualName()] =
+ &cmGlobalCodeWarriorGenerator::New;
+# endif
+ m_Generators[cmGlobalUnixMakefileGenerator::GetActualName()] =
+ &cmGlobalUnixMakefileGenerator::New;
+#endif
+}
+
int cmake::LoadCache()
{
m_CacheManager->LoadCache(this->GetHomeOutputDirectory());
@@ -1188,3 +1174,18 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v) const
cmDocumentationEntry empty = {0,0,0};
v.push_back(empty);
}
+
+void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
+{
+ for(RegisteredGeneratorsMap::const_iterator i = m_Generators.begin();
+ i != m_Generators.end(); ++i)
+ {
+ cmDocumentationEntry e;
+ cmGlobalGenerator* generator = (i->second)();
+ generator->GetDocumentation(e);
+ delete generator;
+ v.push_back(e);
+ }
+ cmDocumentationEntry empty = {0,0,0};
+ v.push_back(empty);
+}