Commit 345cf040 authored by Ken Martin's avatar Ken Martin
Browse files

ENH: big change that includes immediate subdir support, removing the notion of...

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
parent 1f9df24b
......@@ -42,12 +42,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* The name of the command as specified in CMakeList.txt.
*/
......
......@@ -60,7 +60,7 @@ void cmAddTestCommand::FinalPass()
std::vector<std::string>::iterator it;
// for each arg in the test
// for each arg in the test
fout << "ADD_TEST(";
it = m_Args.begin();
fout << (*it).c_str();
......
......@@ -25,6 +25,7 @@
#include "cmAddDependenciesCommand.cxx"
#include "cmAddExecutableCommand.cxx"
#include "cmAddLibraryCommand.cxx"
#include "cmAddSubDirectoryCommand.cxx"
#include "cmAddTestCommand.cxx"
#include "cmBuildCommand.cxx"
#include "cmBuildNameCommand.cxx"
......@@ -81,6 +82,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmAddDependenciesCommand);
commands.push_back(new cmAddExecutableCommand);
commands.push_back(new cmAddLibraryCommand);
commands.push_back(new cmAddSubDirectoryCommand);
commands.push_back(new cmAddTestCommand);
commands.push_back(new cmBuildCommand);
commands.push_back(new cmBuildNameCommand);
......
......@@ -41,12 +41,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* The name of the command as specified in CMakeList.txt.
*/
......
......@@ -41,12 +41,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* The name of the command as specified in CMakeList.txt.
*/
......
......@@ -41,12 +41,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -81,15 +81,6 @@ public:
*/
virtual cmCommand* Clone() = 0;
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited()
{
return false;
}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -41,12 +41,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* The name of the command as specified in CMakeList.txt.
*/
......
......@@ -41,12 +41,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -49,15 +49,6 @@ public:
*/
virtual const char* GetName() {return "ENABLE_LANGUAGE";}
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited()
{
return true;
}
/**
* Succinct documentation.
*/
......
......@@ -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
......@@ -26,15 +26,21 @@ 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;
}
......@@ -43,12 +43,6 @@ public:
return new cmEnableTestingCommand;
}
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
......@@ -90,6 +84,10 @@ public:
}
cmTypeMacro(cmEnableTestingCommand, cmCommand);
///! method to recurse and write the DartTestfiles
void CreateDartTestfileForMakefile(cmMakefile *mf);
};
......
......@@ -47,12 +47,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const&) {return false;}
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -41,12 +41,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -47,12 +47,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const&) {return false;}
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -40,12 +40,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return true;}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -44,12 +44,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() { return false; }
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -44,12 +44,6 @@ public:
*/
virtual bool InitialPass(std::vector<std::string> const& args);
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {return false;}
/**
* This determines if the command is invoked when in script mode.
*/
......
......@@ -388,7 +388,7 @@ std::string cmFindPackageCommand::SearchForConfig() const
//----------------------------------------------------------------------------
bool cmFindPackageCommand::ReadListFile(const char* f)
{
if(m_Makefile->ReadListFile(m_Makefile->GetCurrentListFile(), f))
if(m_Makefile->ReadListFile(m_Makefile->GetCurrentListFile(),f))
{
return true;
}
......
......@@ -35,9 +35,6 @@ public:
return new cmFindPackageCommand;
}
/** This command is inherited. */
virtual bool IsInherited() {return true;}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment