summaryrefslogtreecommitdiffstats
path: root/Source/cmEnableTestingCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-03-18 15:41:41 (GMT)
committerKen Martin <ken.martin@kitware.com>2005-03-18 15:41:41 (GMT)
commit345cf0401235a1fd64bb9b1c353e0e3fc848d666 (patch)
tree6c1862e3516cd436f3068221ae9fcc11144724b8 /Source/cmEnableTestingCommand.cxx
parent1f9df24ba7e76cbd7ecc1816a9f8d46b61816e95 (diff)
downloadCMake-345cf0401235a1fd64bb9b1c353e0e3fc848d666.zip
CMake-345cf0401235a1fd64bb9b1c353e0e3fc848d666.tar.gz
CMake-345cf0401235a1fd64bb9b1c353e0e3fc848d666.tar.bz2
ENH: big change that includes immediate subdir support, removing the notion of inherited commands, makefiles no longer read in the parent makefiles but instead inherit thier parent makefiles current settings
Diffstat (limited to 'Source/cmEnableTestingCommand.cxx')
-rw-r--r--Source/cmEnableTestingCommand.cxx46
1 files changed, 31 insertions, 15 deletions
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx
index 3b717cd..3662596 100644
--- a/Source/cmEnableTestingCommand.cxx
+++ b/Source/cmEnableTestingCommand.cxx
@@ -15,7 +15,7 @@
=========================================================================*/
#include "cmEnableTestingCommand.h"
-#include "cmSubDirectory.h"
+#include "cmLocalGenerator.h"
// we do this in the final pass so that we now the subdirs have all
// been defined
@@ -27,14 +27,20 @@ bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&)
void cmEnableTestingCommand::FinalPass()
{
+ // initialize the DartTestfile files for the tree
+ this->CreateDartTestfileForMakefile(m_Makefile);
+}
+
+void cmEnableTestingCommand::CreateDartTestfileForMakefile(cmMakefile *mf)
+{
// Create a full path filename for output Testfile
std::string fname;
- fname = m_Makefile->GetStartOutputDirectory();
+ fname = mf->GetStartOutputDirectory();
fname += "/";
fname += "DartTestfile.txt";
- cmSystemTools::MakeDirectory(m_Makefile->GetStartOutputDirectory());
-
+ cmSystemTools::MakeDirectory(mf->GetStartOutputDirectory());
+
// Open the output Testfile
std::ofstream fout(fname.c_str());
if (!fout)
@@ -46,9 +52,9 @@ void cmEnableTestingCommand::FinalPass()
fout << "# CMake generated Testfile for " << std::endl
<< "#\tSource directory: "
- << m_Makefile->GetStartDirectory()
+ << mf->GetStartDirectory()
<< std::endl
- << "#\tBuild directory: " << m_Makefile->GetStartOutputDirectory()
+ << "#\tBuild directory: " << mf->GetStartOutputDirectory()
<< std::endl
<< "# " << std::endl
<< "# This file replicates the SUBDIRS() and ADD_TEST() commands from the source"
@@ -62,23 +68,23 @@ void cmEnableTestingCommand::FinalPass()
<< "# Duh :-)" << std::endl << std::endl;
// get our output directory
- std::string outDir = m_Makefile->GetStartOutputDirectory();
+ std::string outDir = mf->GetStartOutputDirectory();
outDir += "/";
// write out the subdirs for the current directory
- if (!m_Makefile->GetSubDirectories().empty())
+ std::vector<cmLocalGenerator *>& children =
+ mf->GetLocalGenerator()->GetChildren();
+
+ unsigned int i;
+ if (children.size())
{
fout << "SUBDIRS(";
- const std::vector<cmSubDirectory>& subdirs
- = m_Makefile->GetSubDirectories();
- std::vector<cmSubDirectory>::const_iterator i = subdirs.begin();
- std::string binP = (*i).BinaryPath;
+ std::string binP = children[0]->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ReplaceString(binP, outDir.c_str(), "");
fout << binP.c_str();
- ++i;
- for(; i != subdirs.end(); ++i)
+ for(i = 1; i < children.size(); ++i)
{
- binP = (*i).BinaryPath;
+ binP = children[i]->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ReplaceString(binP, outDir.c_str(), "");
fout << " " << binP.c_str();
}
@@ -86,6 +92,16 @@ void cmEnableTestingCommand::FinalPass()
}
fout.close();
+ // then recurse
+ if (children.size())
+ {
+ for(i = 0; i < children.size(); ++i)
+ {
+ this->CreateDartTestfileForMakefile(children[i]->GetMakefile());
+ }
+ }
+
+
return;
}