MCPcopy Index your code
hub / github.com/Kitware/CMake / cmCreateTestSourceList

Function cmCreateTestSourceList

Source/cmCreateTestSourceList.cxx:13–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "cmSystemTools.h"
12
13bool cmCreateTestSourceList(std::vector<std::string> const& args,
14 cmExecutionStatus& status)
15{
16 if (args.size() < 3) {
17 status.SetError("called with wrong number of arguments.");
18 return false;
19 }
20
21 auto i = args.begin();
22 std::string extraInclude;
23 std::string function;
24 std::vector<std::string> tests;
25 // extract extra include and function
26 for (; i != args.end(); i++) {
27 if (*i == "EXTRA_INCLUDE") {
28 ++i;
29 if (i == args.end()) {
30 status.SetError("incorrect arguments to EXTRA_INCLUDE");
31 return false;
32 }
33 extraInclude = cmStrCat("#include \"", *i, "\"\n");
34 } else if (*i == "FUNCTION") {
35 ++i;
36 if (i == args.end()) {
37 status.SetError("incorrect arguments to FUNCTION");
38 return false;
39 }
40 function = cmStrCat(*i, "(&ac, &av);\n");
41 } else {
42 tests.push_back(*i);
43 }
44 }
45 i = tests.begin();
46
47 // Name of the source list
48
49 char const* sourceList = i->c_str();
50 ++i;
51
52 // Name of the test driver
53 // make sure they specified an extension
54 if (cmSystemTools::GetFilenameExtension(*i).size() < 2) {
55 status.SetError(
56 "You must specify a file extension for the test driver file.");
57 return false;
58 }
59 cmMakefile& mf = status.GetMakefile();
60 std::string driver = cmStrCat(mf.GetCurrentBinaryDirectory(), '/', *i);
61 ++i;
62
63 std::string configFile = cmSystemTools::GetCMakeRoot();
64
65 configFile += "/Templates/TestDriver.cxx.in";
66 // Create the test driver file
67
68 auto testsBegin = i;
69 std::vector<std::string> tests_func_name;
70

Callers

nothing calls this directly

Calls 14

push_backMethod · 0.80
c_strMethod · 0.80
GetOrCreateSourceMethod · 0.80
cmStrCatFunction · 0.70
findFunction · 0.50
sizeMethod · 0.45
SetErrorMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetMakefileMethod · 0.45
emptyMethod · 0.45
AddDefinitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…