Coverage Report

Created: 2026-02-09 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Source/cmSetDirectoryPropertiesCommand.cxx
Line
Count
Source
1
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2
   file LICENSE.rst 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
0
{
12
0
  if (args.empty()) {
13
0
    status.SetError("called with incorrect number of arguments");
14
0
    return false;
15
0
  }
16
17
  // PROPERTIES followed by prop value pairs
18
0
  if (args.size() % 2 != 1) {
19
0
    status.SetError("Wrong number of arguments");
20
0
    return false;
21
0
  }
22
23
0
  for (auto iter = args.begin() + 1; iter != args.end(); iter += 2) {
24
0
    std::string const& prop = *iter;
25
0
    if (prop == "VARIABLES") {
26
0
      status.SetError(
27
0
        "Variables and cache variables should be set using SET command");
28
0
      return false;
29
0
    }
30
0
    if (prop == "MACROS") {
31
0
      status.SetError(
32
0
        "Commands and macros cannot be set using SET_CMAKE_PROPERTIES");
33
0
      return false;
34
0
    }
35
0
    status.GetMakefile().SetProperty(prop, *(iter + 1));
36
0
  }
37
38
0
  return true;
39
0
}