Coverage Report

Created: 2026-06-15 07:03

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