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