resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmSetDirectoryPropertiesCommand.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 "cmSetDirectoryPropertiesCommand.h"
4
5 #include "cmExecutionStatus.h"
6 #include "cmMakefile.h"
7
8 // cmSetDirectoryPropertiesCommand
9 bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args,
10                                      cmExecutionStatus& status)
11 {
12   if (args.empty()) {
13     status.SetError("called with incorrect number of arguments");
14     return false;
15   }
16
17   // PROPERTIES followed by prop value pairs
18   if (args.size() % 2 != 1) {
19     status.SetError("Wrong number of arguments");
20     return false;
21   }
22
23   for (auto iter = args.begin() + 1; iter != args.end(); iter += 2) {
24     const std::string& prop = *iter;
25     if (prop == "VARIABLES") {
26       status.SetError(
27         "Variables and cache variables should be set using SET command");
28       return false;
29     }
30     if (prop == "MACROS") {
31       status.SetError(
32         "Commands and macros cannot be set using SET_CMAKE_PROPERTIES");
33       return false;
34     }
35     status.GetMakefile().SetProperty(prop, *(iter + 1));
36   }
37
38   return true;
39 }