resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmPropertyDefinition.cxx
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #include "cmPropertyDefinition.h"
4
5 #include <tuple>
6
7 cmPropertyDefinition::cmPropertyDefinition(std::string shortDescription,
8                                            std::string fullDescription,
9                                            bool chained,
10                                            std::string initializeFromVariable)
11   : ShortDescription(std::move(shortDescription))
12   , FullDescription(std::move(fullDescription))
13   , Chained(chained)
14   , InitializeFromVariable(std::move(initializeFromVariable))
15 {
16 }
17
18 void cmPropertyDefinitionMap::DefineProperty(
19   const std::string& name, cmProperty::ScopeType scope,
20   const std::string& ShortDescription, const std::string& FullDescription,
21   bool chain, const std::string& initializeFromVariable)
22 {
23   auto it = this->Map_.find(KeyType(name, scope));
24   if (it == this->Map_.end()) {
25     // try_emplace() since C++17
26     this->Map_.emplace(std::piecewise_construct,
27                        std::forward_as_tuple(name, scope),
28                        std::forward_as_tuple(ShortDescription, FullDescription,
29                                              chain, initializeFromVariable));
30   }
31 }
32
33 cmPropertyDefinition const* cmPropertyDefinitionMap::GetPropertyDefinition(
34   const std::string& name, cmProperty::ScopeType scope) const
35 {
36   auto it = this->Map_.find(KeyType(name, scope));
37   if (it != this->Map_.end()) {
38     return &it->second;
39   }
40
41   return nullptr;
42 }