FIX: stupid pb fixed (close to being medieval'ed by The Ken)
[cmake.git] / Source / cmMakefileGenerator.cxx
blob124d7e5a64ee7bd1a54d1287d22a4e6463bbee59
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmMakefileGenerator.cxx,v $
5 Language: C++
6 Date: $Date: 2002-04-02 20:42:13 $
7 Version: $Revision: 1.9 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 #include "cmMakefileGenerator.h"
19 // static list of registered generators
20 std::map<cmStdString, cmMakefileGenerator*>
21 cmMakefileGenerator::s_RegisteredGenerators;
22 std::map<cmStdString, bool> cmMakefileGenerator::s_LanguageEnabled;
25 void cmMakefileGenerator::SetMakefile(cmMakefile* mf)
27 m_Makefile = mf;
30 void cmMakefileGenerator::UnRegisterGenerators()
32 for(std::map<cmStdString, cmMakefileGenerator*>::iterator i
33 = s_RegisteredGenerators.begin();
34 i != s_RegisteredGenerators.end(); ++i)
36 delete i->second;
38 s_RegisteredGenerators = std::map<cmStdString, cmMakefileGenerator*>();
41 void cmMakefileGenerator::GetRegisteredGenerators(std::vector<std::string>& names)
43 for(std::map<cmStdString, cmMakefileGenerator*>::iterator i
44 = s_RegisteredGenerators.begin();
45 i != s_RegisteredGenerators.end(); ++i)
47 names.push_back(i->first);
52 void
53 cmMakefileGenerator::RegisterGenerator(cmMakefileGenerator* mg)
55 std::map<cmStdString, cmMakefileGenerator*>::iterator i =
56 s_RegisteredGenerators.find(mg->GetName());
57 // delete re-registered objects
58 if(i != s_RegisteredGenerators.end())
60 delete i->second;
62 s_RegisteredGenerators[mg->GetName()] = mg;
66 cmMakefileGenerator*
67 cmMakefileGenerator::CreateGenerator(const char* name)
69 std::map<cmStdString, cmMakefileGenerator*>::iterator i;
70 for(i = s_RegisteredGenerators.begin();
71 i != s_RegisteredGenerators.end(); ++i)
73 cmMakefileGenerator* gen = i->second;
74 if(strcmp(name, gen->GetName()) == 0)
76 return gen->CreateObject();
79 return 0;
84 void cmMakefileGenerator::SetLanguageEnabled(const char* l)
86 s_LanguageEnabled[l] = true;
91 bool cmMakefileGenerator::GetLanguageEnabled(const char* l)
93 return (s_LanguageEnabled.count(l) > 0);
98 void cmMakefileGenerator::ClearEnabledLanguages()
100 s_LanguageEnabled.clear();