Coverage Report

Created: 2026-09-14 06:43

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Source/cmGetTestPropertyCommand.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 "cmGetTestPropertyCommand.h"
4
5
#include "cmExecutionStatus.h"
6
#include "cmMakefile.h"
7
#include "cmTestPropertyHelper.h"
8
#include "cmValue.h"
9
10
bool cmGetTestPropertyCommand(std::vector<std::string> const& args,
11
                              cmExecutionStatus& status)
12
0
{
13
0
  std::vector<std::string>::size_type args_size = args.size();
14
0
  if (args_size != 3 && args_size != 5) {
15
0
    status.SetError("called with incorrect number of arguments");
16
0
    return false;
17
0
  }
18
19
0
  std::string testDirectory;
20
0
  bool testDirectoryOptionEnabled = false;
21
22
0
  int var_arg_index = 2;
23
0
  if (args[2] == "DIRECTORY" && args_size == 5) {
24
0
    var_arg_index = 4;
25
0
    testDirectoryOptionEnabled = true;
26
0
    testDirectory = args[3];
27
0
  }
28
29
0
  std::string const& testName = args[0];
30
0
  std::string const& propertyName = args[1];
31
0
  std::string const& var = args[var_arg_index];
32
33
0
  cmValue prop;
34
0
  auto result =
35
0
    cmGetTestProperty(testName, propertyName, status,
36
0
                      testDirectoryOptionEnabled, testDirectory, prop);
37
0
  if (result == cmGetTestPropertyResult::Success) {
38
0
    if (prop) {
39
0
      status.GetMakefile().AddDefinition(var, prop);
40
0
      return true;
41
0
    }
42
0
    status.GetMakefile().AddDefinition(var, "NOTFOUND");
43
0
    return true;
44
0
  }
45
0
  if (result == cmGetTestPropertyResult::TestNotFound) {
46
0
    status.GetMakefile().AddDefinition(var, "NOTFOUND");
47
0
    return true;
48
0
  }
49
0
  return false;
50
0
}