MCPcopy Create free account
hub / github.com/Kitware/CMake / cmGetTestPropertyCommand

Function cmGetTestPropertyCommand

Source/cmGetTestPropertyCommand.cxx:11–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include "cmValue.h"
10
11bool cmGetTestPropertyCommand(std::vector<std::string> const& args,
12 cmExecutionStatus& status)
13{
14 std::vector<std::string>::size_type args_size = args.size();
15 if (args_size != 3 && args_size != 5) {
16 status.SetError("called with incorrect number of arguments");
17 return false;
18 }
19
20 std::string test_directory;
21 bool test_directory_option_enabled = false;
22
23 int var_arg_index = 2;
24 if (args[2] == "DIRECTORY" && args_size == 5) {
25 var_arg_index = 4;
26 test_directory_option_enabled = true;
27 test_directory = args[3];
28 }
29
30 cmMakefile* test_directory_makefile = &status.GetMakefile();
31 bool file_scopes_handled =
32 SetPropertyCommand::HandleAndValidateTestDirectoryScopes(
33 status, test_directory_option_enabled, test_directory,
34 test_directory_makefile);
35 if (!file_scopes_handled) {
36 return false;
37 }
38
39 std::string const& testName = args[0];
40 std::string const& var = args[var_arg_index];
41 cmMakefile& mf = status.GetMakefile();
42 cmTest* test = test_directory_makefile->GetTest(testName);
43 if (test) {
44 cmValue prop;
45 if (!args[1].empty()) {
46 prop = test->GetProperty(args[1]);
47 }
48 if (prop) {
49 mf.AddDefinition(var, prop);
50 return true;
51 }
52 }
53 mf.AddDefinition(var, "NOTFOUND");
54 return true;
55}

Callers

nothing calls this directly

Calls 8

sizeMethod · 0.45
SetErrorMethod · 0.45
GetMakefileMethod · 0.45
GetTestMethod · 0.45
emptyMethod · 0.45
GetPropertyMethod · 0.45
AddDefinitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…