summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-06-19 16:52:16 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-06-19 16:52:16 (GMT)
commit38145ad5a4cceebc17f434e3c1068c8cc5bb5461 (patch)
tree78650f5ab7a85a37082fcd0b1c15a7f8c840bce4
parentb15808caffd9d32caf75ac892a7b149ff3486ab8 (diff)
downloadCMake-38145ad5a4cceebc17f434e3c1068c8cc5bb5461.zip
CMake-38145ad5a4cceebc17f434e3c1068c8cc5bb5461.tar.gz
CMake-38145ad5a4cceebc17f434e3c1068c8cc5bb5461.tar.bz2
modified create test source to create a vector
-rw-r--r--Source/cmCreateTestSourceList.cxx13
-rw-r--r--Source/cmCreateTestSourceList.h21
-rw-r--r--Source/cmSourceFile.cxx1
-rw-r--r--Source/cmTarget.cxx21
-rw-r--r--Tests/TestDriver/CMakeLists.txt2
5 files changed, 38 insertions, 20 deletions
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 5fc64b7..d320f52 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -257,15 +257,17 @@ 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)
{
cmSourceFile cfile;
@@ -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;
}
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 102226e..8db0814 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -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);
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 43ebf52..0f6e270 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -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;
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index bbb861c..f24da58 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -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));
+ }
}
}
diff --git a/Tests/TestDriver/CMakeLists.txt b/Tests/TestDriver/CMakeLists.txt
index 2e0a1fa..90f37e1 100644
--- a/Tests/TestDriver/CMakeLists.txt
+++ b/Tests/TestDriver/CMakeLists.txt
@@ -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})