modified create test source to create a vector
This commit is contained in:
parent
b15808caff
commit
38145ad5a4
|
@ -257,14 +257,16 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
|
|||
fout.close();
|
||||
|
||||
// Create the source list
|
||||
|
||||
cmSourceFile cfile;
|
||||
std::string sourceListValue;
|
||||
|
||||
cfile.SetIsAnAbstractClass(false);
|
||||
cfile.SetName(args[1].c_str(),
|
||||
m_Makefile->GetCurrentOutputDirectory(),
|
||||
"cxx",
|
||||
false);
|
||||
m_Makefile->AddSource(cfile, sourceList);
|
||||
m_Makefile->AddSource(cfile);
|
||||
sourceListValue = args[1].c_str();
|
||||
|
||||
for(i = testsBegin; i != tests.end(); ++i)
|
||||
{
|
||||
|
@ -274,9 +276,12 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
|
|||
m_Makefile->GetCurrentDirectory(),
|
||||
m_Makefile->GetSourceExtensions(),
|
||||
m_Makefile->GetHeaderExtensions());
|
||||
m_Makefile->AddSource(cfile, sourceList);
|
||||
m_Makefile->AddSource(cfile);
|
||||
sourceListValue += ";";
|
||||
sourceListValue += *i;
|
||||
}
|
||||
|
||||
m_Makefile->AddDefinition(sourceList, sourceListValue.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,16 +67,19 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
"CREATE_TEST_SOURCELIST(SourceListName DriverName test1 test2 test3 EXTRA_INCLUDE include.h FUNCTION function)"
|
||||
"The list of source files needed to build the testdriver will be in SourceListName.\n"
|
||||
"DriverName.cxx is the name of the test driver program.\n"
|
||||
"The rest of the arguments consist of a list of test source files, can be "
|
||||
"CREATE_TEST_SOURCELIST(SourceListName DriverName test1 test2 test3 "
|
||||
"EXTRA_INCLUDE include.h FUNCTION function) The list of source files "
|
||||
"needed to build the testdriver will be in SourceListName. "
|
||||
"DriverName.cxx is the name of the test driver program. The rest of "
|
||||
"the arguments consist of a list of test source files, can be "
|
||||
"; separated. Each test source file should have a function in it that "
|
||||
"is the same name as the file with no extension (foo.cxx should have int foo();) "
|
||||
"DriverName.cxx will be able to call each of the tests by name on the command line. "
|
||||
"If EXTRA_INCLUDE is specified, then the next argument is included into the generated file. "
|
||||
"If FUNCTION is specified, then the next argument is taken as a function name that is passed "
|
||||
"a pointer to ac and av. This can be used to add extra command line processing to each test. ";
|
||||
"is the same name as the file with no extension (foo.cxx should have "
|
||||
"int foo();) DriverName.cxx will be able to call each of the tests by "
|
||||
"name on the command line. If EXTRA_INCLUDE is specified, then the "
|
||||
"next argument is included into the generated file. If FUNCTION is "
|
||||
"specified, then the next argument is taken as a function name that "
|
||||
"is passed a pointer to ac and av. This can be used to add extra "
|
||||
"command line processing to each test. ";
|
||||
}
|
||||
|
||||
cmTypeMacro(cmCreateTestSourceList, cmCommand);
|
||||
|
|
|
@ -122,6 +122,7 @@ void cmSourceFile::SetName(const char* name, const char* dir,
|
|||
}
|
||||
cmSystemTools::Error("can not find file ", pathname.c_str(),
|
||||
errorMsg.c_str());
|
||||
int a = *(int *)0x00;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,12 +50,21 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
|
|||
// if one wasn't found then assume it is a single class
|
||||
else
|
||||
{
|
||||
cmSourceFile file;
|
||||
file.SetIsAnAbstractClass(false);
|
||||
file.SetName(temps.c_str(), mf.GetCurrentDirectory(),
|
||||
mf.GetSourceExtensions(),
|
||||
mf.GetHeaderExtensions());
|
||||
m_SourceFiles.push_back(mf.AddSource(file));
|
||||
// if the source file is already in the makefile, use it
|
||||
if (mf.GetSource(temps.c_str()))
|
||||
{
|
||||
m_SourceFiles.push_back(mf.GetSource(temps.c_str()));
|
||||
}
|
||||
// otherwise try to create it
|
||||
else
|
||||
{
|
||||
cmSourceFile file;
|
||||
file.SetIsAnAbstractClass(false);
|
||||
file.SetName(temps.c_str(), mf.GetCurrentDirectory(),
|
||||
mf.GetSourceExtensions(),
|
||||
mf.GetHeaderExtensions());
|
||||
m_SourceFiles.push_back(mf.AddSource(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,5 +10,5 @@ CREATE_TEST_SOURCELIST(testSrcs
|
|||
subdir/test3
|
||||
EXTRA_INCLUDE testArgs.h FUNCTION testProccessArgs)
|
||||
|
||||
ADD_EXECUTABLE(TestDriverTest testSrcs ${Extra_SRCS})
|
||||
ADD_EXECUTABLE(TestDriverTest ${testSrcs} ${Extra_SRCS})
|
||||
|
||||
|
|
Loading…
Reference in New Issue