ENH: Return utility target after creation
[cmake.git] / Source / cmPropertyDefinitionMap.cxx
blob83bcaffc5aa41b38651131d7e8984aea7cf02f33
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmPropertyDefinitionMap.cxx,v $
5 Language: C++
6 Date: $Date: 2007-10-23 14:40:49 $
7 Version: $Revision: 1.5 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "cmPropertyDefinitionMap.h"
18 #include "cmSystemTools.h"
19 #include "cmDocumentationSection.h"
21 void cmPropertyDefinitionMap
22 ::DefineProperty(const char *name, cmProperty::ScopeType scope,
23 const char *ShortDescription,
24 const char *FullDescription,
25 const char *DocumentationSection,
26 bool chain)
28 if (!name)
30 return;
33 cmPropertyDefinitionMap::iterator it = this->find(name);
34 cmPropertyDefinition *prop;
35 if (it == this->end())
37 prop = &(*this)[name];
38 prop->DefineProperty(name,scope,ShortDescription, FullDescription,
39 DocumentationSection, chain);
43 void cmPropertyDefinitionMap
44 ::GetPropertiesDocumentation(std::map<std::string,
45 cmDocumentationSection *>& v) const
47 for(cmPropertyDefinitionMap::const_iterator j = this->begin();
48 j != this->end(); ++j)
50 // add a section if needed
51 std::string secName = j->second.GetDocumentationSection();
52 // if a section was not specified then use the scope
53 if (!secName.size())
55 switch (j->second.GetScope())
57 case cmProperty::GLOBAL:
58 secName = "Properties of Global Scope";
59 break;
60 case cmProperty::TARGET:
61 secName = "Properties on Targets";
62 break;
63 case cmProperty::SOURCE_FILE:
64 secName = "Properties on Source Files";
65 break;
66 case cmProperty::DIRECTORY:
67 secName = "Properties on Directories";
68 break;
69 case cmProperty::TEST:
70 secName = "Properties on Tests";
71 break;
72 case cmProperty::VARIABLE:
73 secName = "Variables";
74 break;
75 case cmProperty::CACHED_VARIABLE:
76 secName = "Cached Variables";
77 break;
78 default:
79 secName = "Properties of Unknown Scope";
80 break;
83 if (!v[secName])
85 v[secName] = new
86 cmDocumentationSection(secName.c_str(),
87 cmSystemTools::UpperCase(secName).c_str());
89 cmDocumentationEntry e = j->second.GetDocumentation();
90 if (e.Brief.size() || e.Full.size())
92 v[secName]->Append(e);
97 bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name)
99 if (!name)
101 return false;
104 cmPropertyDefinitionMap::iterator it = this->find(name);
105 if (it == this->end())
107 return false;
110 return true;
113 bool cmPropertyDefinitionMap::IsPropertyChained(const char *name)
115 if (!name)
117 return false;
120 cmPropertyDefinitionMap::iterator it = this->find(name);
121 if (it == this->end())
123 return false;
126 return it->second.IsChained();