mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 20:19:53 +00:00
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,14 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
|
||||
clsList.end());
|
||||
}
|
||||
// if one wasn't found then assume it is a single class
|
||||
else
|
||||
{
|
||||
// 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;
|
||||
@ -58,6 +66,7 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
|
||||
m_SourceFiles.push_back(mf.AddSource(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// expand any link library variables whle we are at it
|
||||
LinkLibraries::iterator p = m_LinkLibraries.begin();
|
||||
|
@ -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
Block a user