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

This commit is contained in:
Ken Martin 2005-03-18 10:41:41 -05:00
parent 1f9df24ba7
commit 345cf04012
65 changed files with 493 additions and 798 deletions

View File

@ -42,12 +42,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -60,7 +60,7 @@ void cmAddTestCommand::FinalPass()
std::vector<std::string>::iterator it; std::vector<std::string>::iterator it;
// for each arg in the test // for each arg in the test
fout << "ADD_TEST("; fout << "ADD_TEST(";
it = m_Args.begin(); it = m_Args.begin();
fout << (*it).c_str(); fout << (*it).c_str();

View File

@ -25,6 +25,7 @@
#include "cmAddDependenciesCommand.cxx" #include "cmAddDependenciesCommand.cxx"
#include "cmAddExecutableCommand.cxx" #include "cmAddExecutableCommand.cxx"
#include "cmAddLibraryCommand.cxx" #include "cmAddLibraryCommand.cxx"
#include "cmAddSubDirectoryCommand.cxx"
#include "cmAddTestCommand.cxx" #include "cmAddTestCommand.cxx"
#include "cmBuildCommand.cxx" #include "cmBuildCommand.cxx"
#include "cmBuildNameCommand.cxx" #include "cmBuildNameCommand.cxx"
@ -81,6 +82,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmAddDependenciesCommand); commands.push_back(new cmAddDependenciesCommand);
commands.push_back(new cmAddExecutableCommand); commands.push_back(new cmAddExecutableCommand);
commands.push_back(new cmAddLibraryCommand); commands.push_back(new cmAddLibraryCommand);
commands.push_back(new cmAddSubDirectoryCommand);
commands.push_back(new cmAddTestCommand); commands.push_back(new cmAddTestCommand);
commands.push_back(new cmBuildCommand); commands.push_back(new cmBuildCommand);
commands.push_back(new cmBuildNameCommand); commands.push_back(new cmBuildNameCommand);

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -81,15 +81,6 @@ public:
*/ */
virtual cmCommand* Clone() = 0; 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -49,15 +49,6 @@ public:
*/ */
virtual const char* GetName() {return "ENABLE_LANGUAGE";} 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. * Succinct documentation.
*/ */

View File

@ -15,7 +15,7 @@
=========================================================================*/ =========================================================================*/
#include "cmEnableTestingCommand.h" #include "cmEnableTestingCommand.h"
#include "cmSubDirectory.h" #include "cmLocalGenerator.h"
// we do this in the final pass so that we now the subdirs have all // we do this in the final pass so that we now the subdirs have all
// been defined // been defined
@ -26,15 +26,21 @@ bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&)
} }
void cmEnableTestingCommand::FinalPass() 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 // Create a full path filename for output Testfile
std::string fname; std::string fname;
fname = m_Makefile->GetStartOutputDirectory(); fname = mf->GetStartOutputDirectory();
fname += "/"; fname += "/";
fname += "DartTestfile.txt"; fname += "DartTestfile.txt";
cmSystemTools::MakeDirectory(m_Makefile->GetStartOutputDirectory()); cmSystemTools::MakeDirectory(mf->GetStartOutputDirectory());
// Open the output Testfile // Open the output Testfile
std::ofstream fout(fname.c_str()); std::ofstream fout(fname.c_str());
if (!fout) if (!fout)
@ -46,9 +52,9 @@ void cmEnableTestingCommand::FinalPass()
fout << "# CMake generated Testfile for " << std::endl fout << "# CMake generated Testfile for " << std::endl
<< "#\tSource directory: " << "#\tSource directory: "
<< m_Makefile->GetStartDirectory() << mf->GetStartDirectory()
<< std::endl << std::endl
<< "#\tBuild directory: " << m_Makefile->GetStartOutputDirectory() << "#\tBuild directory: " << mf->GetStartOutputDirectory()
<< std::endl << std::endl
<< "# " << std::endl << "# " << std::endl
<< "# This file replicates the SUBDIRS() and ADD_TEST() commands from the source" << "# This file replicates the SUBDIRS() and ADD_TEST() commands from the source"
@ -62,23 +68,23 @@ void cmEnableTestingCommand::FinalPass()
<< "# Duh :-)" << std::endl << std::endl; << "# Duh :-)" << std::endl << std::endl;
// get our output directory // get our output directory
std::string outDir = m_Makefile->GetStartOutputDirectory(); std::string outDir = mf->GetStartOutputDirectory();
outDir += "/"; outDir += "/";
// write out the subdirs for the current directory // 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("; fout << "SUBDIRS(";
const std::vector<cmSubDirectory>& subdirs std::string binP = children[0]->GetMakefile()->GetStartOutputDirectory();
= m_Makefile->GetSubDirectories();
std::vector<cmSubDirectory>::const_iterator i = subdirs.begin();
std::string binP = (*i).BinaryPath;
cmSystemTools::ReplaceString(binP, outDir.c_str(), ""); cmSystemTools::ReplaceString(binP, outDir.c_str(), "");
fout << binP.c_str(); fout << binP.c_str();
++i; for(i = 1; i < children.size(); ++i)
for(; i != subdirs.end(); ++i)
{ {
binP = (*i).BinaryPath; binP = children[i]->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ReplaceString(binP, outDir.c_str(), ""); cmSystemTools::ReplaceString(binP, outDir.c_str(), "");
fout << " " << binP.c_str(); fout << " " << binP.c_str();
} }
@ -86,6 +92,16 @@ void cmEnableTestingCommand::FinalPass()
} }
fout.close(); fout.close();
// then recurse
if (children.size())
{
for(i = 0; i < children.size(); ++i)
{
this->CreateDartTestfileForMakefile(children[i]->GetMakefile());
}
}
return; return;
} }

View File

@ -43,12 +43,6 @@ public:
return new cmEnableTestingCommand; 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 * This is called when the command is first encountered in
* the CMakeLists.txt file. * the CMakeLists.txt file.
@ -90,6 +84,10 @@ public:
} }
cmTypeMacro(cmEnableTestingCommand, cmCommand); cmTypeMacro(cmEnableTestingCommand, cmCommand);
///! method to recurse and write the DartTestfiles
void CreateDartTestfileForMakefile(cmMakefile *mf);
}; };

View File

@ -47,12 +47,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const&) {return false;} 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -47,12 +47,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const&) {return false;} 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -40,12 +40,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -44,12 +44,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -44,12 +44,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -388,7 +388,7 @@ std::string cmFindPackageCommand::SearchForConfig() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFindPackageCommand::ReadListFile(const char* f) bool cmFindPackageCommand::ReadListFile(const char* f)
{ {
if(m_Makefile->ReadListFile(m_Makefile->GetCurrentListFile(), f)) if(m_Makefile->ReadListFile(m_Makefile->GetCurrentListFile(),f))
{ {
return true; return true;
} }

View File

@ -35,9 +35,6 @@ public:
return new cmFindPackageCommand; return new cmFindPackageCommand;
} }
/** This command is inherited. */
virtual bool IsInherited() {return true;}
/** /**
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * the CMakeLists.txt file.

View File

@ -44,12 +44,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -44,12 +44,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -63,12 +63,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -42,12 +42,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -18,7 +18,6 @@
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmake.h" #include "cmake.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSubDirectory.h"
#include <stdlib.h> // required for atof #include <stdlib.h> // required for atof
@ -492,13 +491,24 @@ void cmGlobalGenerator::Configure()
m_LocalGenerators.push_back(lg); m_LocalGenerators.push_back(lg);
// set the Start directories // set the Start directories
lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory()); lg->GetMakefile()->SetStartDirectory
lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory()); (m_CMakeInstance->GetStartDirectory());
lg->GetMakefile()->SetStartOutputDirectory
(m_CMakeInstance->GetStartOutputDirectory());
lg->GetMakefile()->MakeStartDirectoriesCurrent(); lg->GetMakefile()->MakeStartDirectoriesCurrent();
// now do it // now do it
this->RecursiveConfigure(lg,0.0f,0.9f); lg->Configure();
// update the cache entry for the number of local generators, this is used
// for progress
char num[100];
sprintf(num,"%d",m_LocalGenerators.size());
this->GetCMakeInstance()->AddCacheEntry
("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num,
"number of local generators",
cmCacheManager::INTERNAL);
std::set<cmStdString> notFoundMap; std::set<cmStdString> notFoundMap;
// after it is all done do a ConfigureFinalPass // after it is all done do a ConfigureFinalPass
cmCacheManager* manager = 0; cmCacheManager* manager = 0;
@ -506,7 +516,8 @@ void cmGlobalGenerator::Configure()
{ {
manager = m_LocalGenerators[i]->GetMakefile()->GetCacheManager(); manager = m_LocalGenerators[i]->GetMakefile()->GetCacheManager();
m_LocalGenerators[i]->ConfigureFinalPass(); m_LocalGenerators[i]->ConfigureFinalPass();
cmTargets const& targets = m_LocalGenerators[i]->GetMakefile()->GetTargets(); cmTargets const& targets =
m_LocalGenerators[i]->GetMakefile()->GetTargets();
for (cmTargets::const_iterator l = targets.begin(); for (cmTargets::const_iterator l = targets.begin();
l != targets.end(); l++) l != targets.end(); l++)
{ {
@ -535,7 +546,7 @@ void cmGlobalGenerator::Configure()
} }
} }
m_CMakeInstance->UpdateProgress("Configuring", m_CMakeInstance->UpdateProgress("Configuring",
0.9f+0.1f*(i+1.0f)/m_LocalGenerators.size()); 0.9f+0.1f*(i+1.0f)/m_LocalGenerators.size());
m_LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops(); m_LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops();
} }
} }
@ -572,52 +583,13 @@ void cmGlobalGenerator::Configure()
} }
} }
// loop through the directories creating cmLocalGenerators and Configure()
void cmGlobalGenerator::RecursiveConfigure(cmLocalGenerator *lg,
float startProgress,
float endProgress)
{
// configure the current directory
lg->Configure();
// get all the subdirectories
std::vector<cmSubDirectory> subdirs =
lg->GetMakefile()->GetSubDirectories();
float progressPiece = (endProgress - startProgress)/(1.0f+subdirs.size());
m_CMakeInstance->UpdateProgress("Configuring",
startProgress + progressPiece);
// for each subdir recurse
std::vector<cmSubDirectory>::const_iterator sdi = subdirs.begin();
int i;
for (i = 0; sdi != subdirs.end(); ++sdi, ++i)
{
cmLocalGenerator *lg2 = this->CreateLocalGenerator();
lg2->SetParent(lg);
m_LocalGenerators.push_back(lg2);
// add the subdir to the start output directory
lg2->GetMakefile()->SetStartOutputDirectory(sdi->BinaryPath.c_str());
lg2->SetExcludeAll(!sdi->IncludeTopLevel);
// add the subdir to the start source directory
lg2->GetMakefile()->SetStartDirectory(sdi->SourcePath.c_str());
lg2->GetMakefile()->MakeStartDirectoriesCurrent();
this->RecursiveConfigure(lg2,
startProgress + (i+1.0f)*progressPiece,
startProgress + (i+2.0f)*progressPiece);
}
}
void cmGlobalGenerator::Generate() void cmGlobalGenerator::Generate()
{ {
// For each existing cmLocalGenerator // For each existing cmLocalGenerator
unsigned int i; unsigned int i;
for (i = 0; i < m_LocalGenerators.size(); ++i) for (i = 0; i < m_LocalGenerators.size(); ++i)
{ {
m_LocalGenerators[i]->Generate(true); m_LocalGenerators[i]->Generate();
m_LocalGenerators[i]->GenerateInstallRules(); m_LocalGenerators[i]->GenerateInstallRules();
m_CMakeInstance->UpdateProgress("Generating", m_CMakeInstance->UpdateProgress("Generating",
(i+1.0f)/m_LocalGenerators.size()); (i+1.0f)/m_LocalGenerators.size());
@ -753,6 +725,30 @@ int cmGlobalGenerator::Build(
return retVal; return retVal;
} }
void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
{
m_LocalGenerators.push_back(lg);
// update progress
// estimate how many lg there will be
const char *numGenC =
m_CMakeInstance->GetCacheManager()->GetCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
if (!numGenC)
{
return;
}
int numGen = atoi(numGenC);
float prog = 0.9f*m_LocalGenerators.size()/numGen;
if (prog > 0.9f)
{
prog = 0.9f;
}
m_CMakeInstance->UpdateProgress("Configuring", prog);
}
cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator() cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
{ {
cmLocalGenerator *lg = new cmLocalGenerator; cmLocalGenerator *lg = new cmLocalGenerator;

View File

@ -109,6 +109,8 @@ public:
void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;} void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;} void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;}
void AddLocalGenerator(cmLocalGenerator *lg);
static int s_TryCompileTimeout; static int s_TryCompileTimeout;
bool GetForceUnixPaths() {return m_ForceUnixPaths;} bool GetForceUnixPaths() {return m_ForceUnixPaths;}
@ -149,9 +151,6 @@ protected:
// map from project name to vector of local generators in that project // map from project name to vector of local generators in that project
std::map<cmStdString, std::vector<cmLocalGenerator*> > m_ProjectMap; std::map<cmStdString, std::vector<cmLocalGenerator*> > m_ProjectMap;
///! used by Configure()
void RecursiveConfigure(cmLocalGenerator *lg, float start, float end);
///! Find a target by name by searching the local generators. ///! Find a target by name by searching the local generators.
cmTarget* FindTarget(const char* project, const char* name); cmTarget* FindTarget(const char* project, const char* name);
private: private:

View File

@ -81,12 +81,6 @@ public:
return "Conditionally execute a group of commands."; return "Conditionally execute a group of commands.";
} }
/**
* 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -44,12 +44,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -42,12 +42,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -48,15 +48,6 @@ public:
*/ */
virtual const char* GetName() {return "INCLUDE_REGULAR_EXPRESSION";} virtual const char* GetName() {return "INCLUDE_REGULAR_EXPRESSION";}
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited()
{
return true;
}
/** /**
* Succinct documentation. * Succinct documentation.
*/ */

View File

@ -44,12 +44,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -43,12 +43,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -59,14 +59,6 @@ public:
*/ */
virtual void FinalPass(); virtual void FinalPass();
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited() {
return (info.m_Inherited != 0 ? true : false);
}
/** /**
* The name of the command as specified in CMakeList.txt. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -20,7 +20,6 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmSubDirectory.h"
#include "cmOrderLinkDirectories.h" #include "cmOrderLinkDirectories.h"
cmLocalGenerator::cmLocalGenerator() cmLocalGenerator::cmLocalGenerator()
@ -32,6 +31,7 @@ cmLocalGenerator::cmLocalGenerator()
m_WindowsShell = false; m_WindowsShell = false;
m_IgnoreLibPrefix = false; m_IgnoreLibPrefix = false;
m_UseRelativePaths = false; m_UseRelativePaths = false;
this->Configured = false;
} }
cmLocalGenerator::~cmLocalGenerator() cmLocalGenerator::~cmLocalGenerator()
@ -53,6 +53,20 @@ void cmLocalGenerator::Configure()
currentStart += "/CMakeLists.txt"; currentStart += "/CMakeLists.txt";
m_Makefile->ReadListFile(currentStart.c_str()); m_Makefile->ReadListFile(currentStart.c_str());
// at the end of the ReadListFile handle any old style subdirs
// first get all the subdirectories
std::vector<cmLocalGenerator *> subdirs = this->GetChildren();
// for each subdir recurse
std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin();
for (; sdi != subdirs.end(); ++sdi)
{
if (!(*sdi)->Configured)
{
m_Makefile->ConfigureSubDirectory(*sdi);
}
}
// Setup the current output directory components for use by // Setup the current output directory components for use by
// ConvertToRelativePath. // ConvertToRelativePath.
std::string outdir = std::string outdir =
@ -62,6 +76,8 @@ void cmLocalGenerator::Configure()
// Check whether relative paths should be used for optionally // Check whether relative paths should be used for optionally
// relative paths. // relative paths.
m_UseRelativePaths = m_Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS"); m_UseRelativePaths = m_Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS");
this->Configured = true;
} }
void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
@ -316,14 +332,13 @@ void cmLocalGenerator::GenerateInstallRules()
fout << "INCLUDE(\"" << postinstall << "\")" << std::endl; fout << "INCLUDE(\"" << postinstall << "\")" << std::endl;
} }
} }
cmMakefile* mf = this->GetMakefile();
if ( !mf->GetSubDirectories().empty() ) if ( this->Children.size())
{ {
const std::vector<cmSubDirectory>& subdirs = mf->GetSubDirectories(); std::vector<cmLocalGenerator*>::const_iterator i = this->Children.begin();
std::vector<cmSubDirectory>::const_iterator i = subdirs.begin(); for(; i != this->Children.end(); ++i)
for(; i != subdirs.end(); ++i)
{ {
std::string odir = i->BinaryPath; std::string odir = (*i)->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ConvertToUnixSlashes(odir); cmSystemTools::ConvertToUnixSlashes(odir);
fout << "INCLUDE(\"" << odir.c_str() fout << "INCLUDE(\"" << odir.c_str()
<< "/cmake_install.cmake\")" << std::endl; << "/cmake_install.cmake\")" << std::endl;

View File

@ -39,13 +39,9 @@ public:
virtual ~cmLocalGenerator(); virtual ~cmLocalGenerator();
/** /**
* Generate the makefile for this directory. fromTheTop indicates if this * Generate the makefile for this directory.
* is being invoked as part of a global Generate or specific to this
* directory. The difference is that when done from the Top we might skip
* some steps to save time, such as dependency generation for the
* makefiles. This is done by a direct invocation from make.
*/ */
virtual void Generate(bool /* fromTheTop */) {}; virtual void Generate() {};
/** /**
* Process the CMakeLists files for this directory to fill in the * Process the CMakeLists files for this directory to fill in the
@ -118,7 +114,12 @@ public:
///! set/get the parent generator ///! set/get the parent generator
cmLocalGenerator* GetParent(){return m_Parent;} cmLocalGenerator* GetParent(){return m_Parent;}
void SetParent(cmLocalGenerator* g) { m_Parent = g;} void SetParent(cmLocalGenerator* g) { m_Parent = g; g->AddChild(this); }
///! set/get the children
void AddChild(cmLocalGenerator* g) { this->Children.push_back(g); }
std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
void AddLanguageFlags(std::string& flags, const char* lang); void AddLanguageFlags(std::string& flags, const char* lang);
void AddSharedFlags(std::string& flags, const char* lang, bool shared); void AddSharedFlags(std::string& flags, const char* lang, bool shared);
@ -185,10 +186,12 @@ protected:
std::vector<std::string> m_CurrentOutputDirectoryComponents; std::vector<std::string> m_CurrentOutputDirectoryComponents;
bool m_ExcludeFromAll; bool m_ExcludeFromAll;
cmLocalGenerator* m_Parent; cmLocalGenerator* m_Parent;
std::vector<cmLocalGenerator*> Children;
std::map<cmStdString, cmStdString> m_LanguageToIncludeFlags; std::map<cmStdString, cmStdString> m_LanguageToIncludeFlags;
bool m_WindowsShell; bool m_WindowsShell;
bool m_UseRelativePaths; bool m_UseRelativePaths;
bool m_IgnoreLibPrefix; bool m_IgnoreLibPrefix;
bool Configured;
}; };
#endif #endif

View File

@ -36,9 +36,3 @@ cmLocalKdevelopGenerator::~cmLocalKdevelopGenerator()
{ {
} }
void cmLocalKdevelopGenerator::Generate(bool fromTheTop)
{
cmLocalUnixMakefileGenerator2::Generate(fromTheTop);
return;
}

View File

@ -35,7 +35,6 @@ public:
virtual ~cmLocalKdevelopGenerator(); virtual ~cmLocalKdevelopGenerator();
virtual void Generate(bool fromTheTop);
}; };
#endif #endif

View File

@ -21,7 +21,6 @@
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmSubDirectory.h"
#include "cmake.h" #include "cmake.h"
// Include dependency scanners for supported languages. Only the // Include dependency scanners for supported languages. Only the
@ -69,16 +68,8 @@ void cmLocalUnixMakefileGenerator2::SetEmptyCommand(const char* cmd)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator2::Generate(bool fromTheTop) void cmLocalUnixMakefileGenerator2::Generate()
{ {
// Make sure we never run a local generate.
if(!fromTheTop)
{
cmSystemTools::Error("Local generate invoked in ",
m_Makefile->GetStartOutputDirectory());
return;
}
// Setup our configuration variables for this directory. // Setup our configuration variables for this directory.
this->ConfigureOutputPaths(); this->ConfigureOutputPaths();
@ -1314,24 +1305,25 @@ cmLocalUnixMakefileGenerator2
// boolean is true should be included. Keep track of the last // boolean is true should be included. Keep track of the last
// pre-order and last post-order rule created so that ordering can // pre-order and last post-order rule created so that ordering can
// be enforced. // be enforced.
const std::vector<cmSubDirectory>& subdirs = m_Makefile->GetSubDirectories();
std::string lastPre = ""; std::string lastPre = "";
std::string lastPost = ""; std::string lastPost = "";
for(std::vector<cmSubDirectory>::const_iterator for(std::vector<cmLocalGenerator*>::const_iterator
i = subdirs.begin(); i != subdirs.end(); ++i) i = this->Children.begin(); i != this->Children.end(); ++i)
{ {
if(i->IncludeTopLevel) if(!(*i)->GetExcludeAll())
{ {
// Add the subdirectory rule either for pre-order or post-order. // Add the subdirectory rule either for pre-order or post-order.
if(i->PreOrder) if((*i)->GetMakefile()->GetPreOrder())
{ {
this->WriteSubdirRule(makefileStream, pass, this->WriteSubdirRule(makefileStream, pass,
i->BinaryPath.c_str(), lastPre); (*i)->GetMakefile()->GetStartOutputDirectory(),
lastPre);
} }
else else
{ {
this->WriteSubdirRule(makefileStream, pass, this->WriteSubdirRule(makefileStream, pass,
i->BinaryPath.c_str(), lastPost); (*i)->GetMakefile()->GetStartOutputDirectory(),
lastPost);
} }
} }
} }

View File

@ -85,13 +85,9 @@ public:
void SetPassMakeflags(bool s){m_PassMakeflags = s;} void SetPassMakeflags(bool s){m_PassMakeflags = s;}
/** /**
* Generate the makefile for this directory. fromTheTop indicates if this * Generate the makefile for this directory.
* is being invoked as part of a global Generate or specific to this
* directory. The difference is that when done from the Top we might skip
* some steps to save time, such as dependency generation for the
* makefiles. This is done by a direct invocation from make.
*/ */
virtual void Generate(bool fromTheTop); virtual void Generate();
/** Called from command-line hook to scan dependencies. */ /** Called from command-line hook to scan dependencies. */
static bool ScanDependencies(std::vector<std::string> const& args); static bool ScanDependencies(std::vector<std::string> const& args);

View File

@ -33,7 +33,7 @@ cmLocalVisualStudio6Generator::~cmLocalVisualStudio6Generator()
} }
void cmLocalVisualStudio6Generator::Generate(bool /* fromTheTop */) void cmLocalVisualStudio6Generator::Generate()
{ {
std::set<cmStdString> lang; std::set<cmStdString> lang;
lang.insert("C"); lang.insert("C");

View File

@ -40,13 +40,9 @@ public:
virtual ~cmLocalVisualStudio6Generator(); virtual ~cmLocalVisualStudio6Generator();
/** /**
* Generate the makefile for this directory. fromTheTop indicates if this * Generate the makefile for this directory.
* is being invoked as part of a global Generate or specific to this
* directory. The difference is that when done from the Top we might skip
* some steps to save time, such as dependency generation for the
* makefiles. This is done by a direct invocation from make.
*/ */
virtual void Generate(bool fromTheTop); virtual void Generate();
void OutputDSPFile(); void OutputDSPFile();

View File

@ -32,7 +32,7 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
} }
void cmLocalVisualStudio7Generator::Generate(bool /* fromTheTop */) void cmLocalVisualStudio7Generator::Generate()
{ {
std::set<cmStdString> lang; std::set<cmStdString> lang;
lang.insert("C"); lang.insert("C");

View File

@ -41,13 +41,9 @@ public:
virtual ~cmLocalVisualStudio7Generator(); virtual ~cmLocalVisualStudio7Generator();
/** /**
* Generate the makefile for this directory. fromTheTop indicates if this * Generate the makefile for this directory.
* is being invoked as part of a global Generate or specific to this
* directory. The difference is that when done from the Top we might skip
* some steps to save time, such as dependency generation for the
* makefiles. This is done by a direct invocation from make.
*/ */
virtual void Generate(bool fromTheTop); virtual void Generate();
enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY}; enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};

View File

@ -16,214 +16,287 @@
=========================================================================*/ =========================================================================*/
#include "cmMacroCommand.h" #include "cmMacroCommand.h"
// define the class for macro commands
class cmMacroHelperCommand : public cmCommand
{
public:
cmMacroHelperCommand() {}
///! clean up any memory allocated by the macro
~cmMacroHelperCommand() {};
/**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
{
cmMacroHelperCommand *newC = new cmMacroHelperCommand;
// we must copy when we clone
newC->m_Args = this->m_Args;
newC->m_Functions = this->m_Functions;
return newC;
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args);
virtual bool InitialPass(std::vector<std::string> const& args)
{ return false; };
/**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return this->m_Args[0].c_str(); }
/**
* Succinct documentation.
*/
virtual const char* GetTerseDocumentation()
{
std::string docs = "Macro named: ";
docs += this->GetName();
return docs.c_str();
}
/**
* More documentation.
*/
virtual const char* GetFullDocumentation()
{
return this->GetTerseDocumentation();
}
cmTypeMacro(cmMacroHelperCommand, cmCommand);
std::vector<std::string> m_Args;
std::vector<cmListFileFunction> m_Functions;
};
bool cmMacroHelperCommand::InvokeInitialPass
(const std::vector<cmListFileArgument>& args)
{
// Expand the argument list to the macro.
std::vector<std::string> expandedArgs;
m_Makefile->ExpandArguments(args, expandedArgs);
std::string tmps;
cmListFileArgument arg;
std::string variable;
// make sure the number of arguments passed is at least the number
// required by the signature
if (expandedArgs.size() < m_Args.size() - 1)
{
std::string errorMsg =
"Macro invoked with incorrect arguments for macro named: ";
errorMsg += m_Args[0];
this->SetError(errorMsg.c_str());
return false;
}
// set the value of argc
cmOStringStream argcDefStream;
argcDefStream << expandedArgs.size();
std::string argcDef = argcDefStream.str();
// declare varuiables for ARGV ARGN but do not compute until needed
std::string argvDef;
std::string argnDef;
bool argnDefInitialized = false;
bool argvDefInitialized = false;
// Invoke all the functions that were collected in the block.
cmListFileFunction newLFF;
// for each function
for(unsigned int c = 0; c < m_Functions.size(); ++c)
{
// Replace the formal arguments and then invoke the command.
newLFF.m_Arguments.clear();
newLFF.m_Arguments.reserve(m_Functions[c].m_Arguments.size());
newLFF.m_Name = m_Functions[c].m_Name;
newLFF.m_FilePath = m_Functions[c].m_FilePath;
newLFF.m_Line = m_Functions[c].m_Line;
// for each argument of the current function
for (std::vector<cmListFileArgument>::const_iterator k =
m_Functions[c].m_Arguments.begin();
k != m_Functions[c].m_Arguments.end(); ++k)
{
tmps = k->Value;
// replace formal arguments
for (unsigned int j = 1; j < m_Args.size(); ++j)
{
variable = "${";
variable += m_Args[j];
variable += "}";
cmSystemTools::ReplaceString(tmps, variable.c_str(),
expandedArgs[j-1].c_str());
}
// replace argc
cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
// repleace ARGN
if (tmps.find("${ARGN}") != std::string::npos)
{
if (!argnDefInitialized)
{
std::vector<std::string>::const_iterator eit;
std::vector<std::string>::size_type cnt = 0;
for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit )
{
if ( cnt >= m_Args.size()-1 )
{
if ( argnDef.size() > 0 )
{
argnDef += ";";
}
argnDef += *eit;
}
cnt ++;
}
argnDefInitialized = true;
}
cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
}
// if the current argument of the current function has ${ARGV in it
// then try replacing ARGV values
if (tmps.find("${ARGV") != std::string::npos)
{
char argvName[60];
// repleace ARGV, compute it only once
if (!argvDefInitialized)
{
std::vector<std::string>::const_iterator eit;
for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit )
{
if ( argvDef.size() > 0 )
{
argvDef += ";";
}
argvDef += *eit;
}
argvDefInitialized = true;
}
cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
// also replace the ARGV1 ARGV2 ... etc
for (unsigned int t = 0; t < expandedArgs.size(); ++t)
{
sprintf(argvName,"${ARGV%i}",t);
cmSystemTools::ReplaceString(tmps, argvName,
expandedArgs[t].c_str());
}
}
arg.Value = tmps;
arg.Quoted = k->Quoted;
const char* def =
m_Makefile->GetDefinition("CMAKE_MACRO_REPORT_DEFINITION_LOCATION");
if(def && !cmSystemTools::IsOff(def))
{
// Report the location of the argument where the macro was
// defined.
arg.FilePath = k->FilePath;
arg.Line = k->Line;
}
else
{
// Report the location of the argument where the macro was
// invoked.
if (args.size())
{
arg.FilePath = args[0].FilePath;
arg.Line = args[0].Line;
}
else
{
arg.FilePath = "Unknown";
arg.Line = 0;
}
}
newLFF.m_Arguments.push_back(arg);
}
if(!m_Makefile->ExecuteCommand(newLFF))
{
cmOStringStream error;
error << "Error in cmake code at\n"
<< args[0].FilePath << ":" << args[0].Line << ":\n"
<< "A command failed during the invocation of macro \""
<< this->m_Args[0].c_str() << "\".";
cmSystemTools::Error(error.str().c_str());
return false;
}
}
return true;
}
bool cmMacroFunctionBlocker:: bool cmMacroFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
{ {
// record commands until we hit the ENDMACRO // record commands until we hit the ENDMACRO
if (!m_Executing) // at the ENDMACRO call we shift gears and start looking for invocations
if(lff.m_Name == "ENDMACRO")
{ {
// at the ENDMACRO call we shift gears and start looking for invocations
if(lff.m_Name == "ENDMACRO")
{
std::vector<std::string> expandedArguments;
mf.ExpandArguments(lff.m_Arguments, expandedArguments);
if(!expandedArguments.empty() && (expandedArguments[0] == m_Args[0]))
{
m_Executing = true;
std::string name = m_Args[0];
std::vector<std::string>::size_type cc;
name += "(";
for ( cc = 0; cc < m_Args.size(); cc ++ )
{
name += " " + m_Args[cc];
}
name += " )";
mf.AddMacro(m_Args[0].c_str(), name.c_str());
return true;
}
}
// if it wasn't an endmacro and we are not executing then we must be
// recording
m_Functions.push_back(lff);
return true;
}
// otherwise the macro has been recorded and we are executing
// so we look for macro invocations
if(lff.m_Name == m_Args[0])
{
std::string tmps;
cmListFileArgument arg;
std::string variable;
// Expand the argument list to the macro.
std::vector<std::string> expandedArguments; std::vector<std::string> expandedArguments;
mf.ExpandArguments(lff.m_Arguments, expandedArguments); mf.ExpandArguments(lff.m_Arguments, expandedArguments);
if(!expandedArguments.empty() && (expandedArguments[0] == m_Args[0]))
// make sure the number of arguments passed is at least the number
// required by the signature
if (expandedArguments.size() < m_Args.size() - 1)
{ {
cmOStringStream error; std::string name = m_Args[0];
error << "Error in cmake code at\n" std::vector<std::string>::size_type cc;
<< lff.m_FilePath << ":" << lff.m_Line << ":\n" name += "(";
<< "Invocation of macro \"" for ( cc = 0; cc < m_Args.size(); cc ++ )
<< lff.m_Name.c_str() << "\" with incorrect number of arguments."; {
cmSystemTools::Error(error.str().c_str()); name += " " + m_Args[cc];
}
name += " )";
mf.AddMacro(m_Args[0].c_str(), name.c_str());
// create a new command and add it to cmake
cmMacroHelperCommand *f = new cmMacroHelperCommand();
f->m_Args = this->m_Args;
f->m_Functions = this->m_Functions;
mf.AddCommand(f);
// remove the function blocker now that the macro is defined
mf.RemoveFunctionBlocker(lff);
return true; return true;
} }
// set the value of argc
cmOStringStream argcDefStream;
argcDefStream << expandedArguments.size();
std::string argcDef = argcDefStream.str();
// declare varuiables for ARGV ARGN but do not compute until needed
std::string argvDef;
std::string argnDef;
bool argnDefInitialized = false;
bool argvDefInitialized = false;
// Invoke all the functions that were collected in the block.
cmListFileFunction newLFF;
// for each function
for(unsigned int c = 0; c < m_Functions.size(); ++c)
{
// Replace the formal arguments and then invoke the command.
newLFF.m_Arguments.clear();
newLFF.m_Arguments.reserve(m_Functions[c].m_Arguments.size());
newLFF.m_Name = m_Functions[c].m_Name;
newLFF.m_FilePath = m_Functions[c].m_FilePath;
newLFF.m_Line = m_Functions[c].m_Line;
// for each argument of the current function
for (std::vector<cmListFileArgument>::const_iterator k =
m_Functions[c].m_Arguments.begin();
k != m_Functions[c].m_Arguments.end(); ++k)
{
tmps = k->Value;
// replace formal arguments
for (unsigned int j = 1; j < m_Args.size(); ++j)
{
variable = "${";
variable += m_Args[j];
variable += "}";
cmSystemTools::ReplaceString(tmps, variable.c_str(),
expandedArguments[j-1].c_str());
}
// replace argc
cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
// repleace ARGN
if (tmps.find("${ARGN}") != std::string::npos)
{
if (!argnDefInitialized)
{
std::vector<std::string>::iterator eit;
std::vector<std::string>::size_type cnt = 0;
for ( eit = expandedArguments.begin();
eit != expandedArguments.end();
++ eit )
{
if ( cnt >= m_Args.size()-1 )
{
if ( argnDef.size() > 0 )
{
argnDef += ";";
}
argnDef += *eit;
}
cnt ++;
}
argnDefInitialized = true;
}
cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
}
// if the current argument of the current function has ${ARGV in it
// then try replacing ARGV values
if (tmps.find("${ARGV") != std::string::npos)
{
char argvName[60];
// repleace ARGV, compute it only once
if (!argvDefInitialized)
{
std::vector<std::string>::iterator eit;
for ( eit = expandedArguments.begin();
eit != expandedArguments.end();
++ eit )
{
if ( argvDef.size() > 0 )
{
argvDef += ";";
}
argvDef += *eit;
}
argvDefInitialized = true;
}
cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
// also replace the ARGV1 ARGV2 ... etc
for (unsigned int t = 0; t < expandedArguments.size(); ++t)
{
sprintf(argvName,"${ARGV%i}",t);
cmSystemTools::ReplaceString(tmps, argvName,
expandedArguments[t].c_str());
}
}
arg.Value = tmps;
arg.Quoted = k->Quoted;
const char* def =
mf.GetDefinition("CMAKE_MACRO_REPORT_DEFINITION_LOCATION");
if(def && !cmSystemTools::IsOff(def))
{
// Report the location of the argument where the macro was
// defined.
arg.FilePath = k->FilePath;
arg.Line = k->Line;
}
else
{
// Report the location of the argument where the macro was
// invoked.
arg.FilePath = lff.m_FilePath;
arg.Line = lff.m_Line;
}
newLFF.m_Arguments.push_back(arg);
}
if(!mf.ExecuteCommand(newLFF))
{
cmOStringStream error;
error << "Error in cmake code at\n"
<< lff.m_FilePath << ":" << lff.m_Line << ":\n"
<< "A command failed during the invocation of macro \""
<< lff.m_Name.c_str() << "\".";
cmSystemTools::Error(error.str().c_str());
}
}
return true;
} }
// if not an invocation then it is just an ordinary line // if it wasn't an endmacro and we are not executing then we must be
return false; // recording
m_Functions.push_back(lff);
return true;
} }
bool cmMacroFunctionBlocker:: bool cmMacroFunctionBlocker::
ShouldRemove(const cmListFileFunction&, cmMakefile &) ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
{ {
if(lff.m_Name == "ENDMACRO")
{
std::vector<std::string> expandedArguments;
mf.ExpandArguments(lff.m_Arguments, expandedArguments);
if(!expandedArguments.empty() && (expandedArguments[0] == m_Args[0]))
{
return true;
}
}
return false; return false;
} }
void cmMacroFunctionBlocker:: void cmMacroFunctionBlocker::
ScopeEnded(cmMakefile &mf) ScopeEnded(cmMakefile &mf)
{ {
// macros never leave scope but we should have seen the ENDMACRO call by now // macros should end with an EndMacro
if (m_Executing != true) cmSystemTools::Error("The end of a CMakeLists file was reached with a MACRO statement that was not closed properly. Within the directory: ",
{ mf.GetCurrentDirectory(), " with macro ",
cmSystemTools::Error("The end of a CMakeLists file was reached with a MACRO statement that was not closed properly. Within the directory: ", m_Args[0].c_str());
mf.GetCurrentDirectory(), " with macro ",
m_Args[0].c_str());
}
} }
bool cmMacroCommand::InitialPass(std::vector<std::string> const& args) bool cmMacroCommand::InitialPass(std::vector<std::string> const& args)

View File

@ -28,7 +28,7 @@
class cmMacroFunctionBlocker : public cmFunctionBlocker class cmMacroFunctionBlocker : public cmFunctionBlocker
{ {
public: public:
cmMacroFunctionBlocker() {m_Executing = false;} cmMacroFunctionBlocker() {}
virtual ~cmMacroFunctionBlocker() {} virtual ~cmMacroFunctionBlocker() {}
virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile &mf); virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile &mf);
virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf); virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf);
@ -36,7 +36,6 @@ public:
std::vector<std::string> m_Args; std::vector<std::string> m_Args;
std::vector<cmListFileFunction> m_Functions; std::vector<cmListFileFunction> m_Functions;
bool m_Executing;
}; };
/** \class cmMacroCommand /** \class cmMacroCommand
@ -61,12 +60,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -73,7 +73,9 @@ cmMakefile::cmMakefile()
this->AddSourceGroup("CMake Rules", "\\.rule$"); this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddDefaultDefinitions(); this->AddDefaultDefinitions();
m_cmDefineRegex.compile("#cmakedefine[ \t]*([A-Za-z_0-9]*)"); m_cmDefineRegex.compile("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
}
this->PreOrder = false;
}
const char* cmMakefile::GetReleaseVersion() const char* cmMakefile::GetReleaseVersion()
{ {
@ -248,30 +250,25 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
(!this->GetCMakeInstance()->GetScriptMode() || (!this->GetCMakeInstance()->GetScriptMode() ||
usedCommand->IsScriptable())) usedCommand->IsScriptable()))
{ {
// if not running in inherit mode or if(!usedCommand->InvokeInitialPass(lff.m_Arguments))
// if the command is inherited then InitialPass it.
if(!m_Inheriting || usedCommand->IsInherited())
{ {
if(!usedCommand->InvokeInitialPass(lff.m_Arguments)) cmOStringStream error;
error << "Error in cmake code at\n"
<< lff.m_FilePath << ":" << lff.m_Line << ":\n"
<< usedCommand->GetError();
cmSystemTools::Error(error.str().c_str());
result = false;
if ( this->GetCMakeInstance()->GetScriptMode() )
{ {
cmOStringStream error; cmSystemTools::SetFatalErrorOccured();
error << "Error in cmake code at\n"
<< lff.m_FilePath << ":" << lff.m_Line << ":\n"
<< usedCommand->GetError();
cmSystemTools::Error(error.str().c_str());
result = false;
if ( this->GetCMakeInstance()->GetScriptMode() )
{
cmSystemTools::SetFatalErrorOccured();
}
}
else
{
// use the command
keepCommand = true;
m_UsedCommands.push_back(usedCommand);
} }
} }
else
{
// use the command
keepCommand = true;
m_UsedCommands.push_back(usedCommand);
}
} }
else if ( this->GetCMakeInstance()->GetScriptMode() && !usedCommand->IsScriptable() ) else if ( this->GetCMakeInstance()->GetScriptMode() && !usedCommand->IsScriptable() )
{ {
@ -306,16 +303,9 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
return result; return result;
} }
// Parse the given CMakeLists.txt file into a list of classes. // Parse the given CMakeLists.txt file executing all commands
// Reads in current CMakeLists file and all parent CMakeLists files
// executing all inherited commands in the parents
// //
// if external is non-zero, this means that we have branched to grab some bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in)
// commands from a remote list-file (that is, the equivalent of a
// #include has been called). We DO NOT look at the parents of this
// list-file, and for all other purposes, the name of this list-file
// is "filename" and not "external".
bool cmMakefile::ReadListFile(const char* filename_in, const char* external_in)
{ {
// used to watch for blockers going out of scope // used to watch for blockers going out of scope
// e.g. mismatched IF statement // e.g. mismatched IF statement
@ -358,47 +348,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, const char* external_in)
} }
} }
// if this is not a remote makefile
// (if it were, this would be called from the "filename" call,
// rather than the "external" call)
if (!external)
{
// is there a parent CMakeLists file that does not go beyond the
// Home directory? if so recurse and read in that List file
std::string parentList = this->GetParentListFileName();
if (parentList != "")
{
std::string srcdir = this->GetCurrentDirectory();
std::string bindir = this->GetCurrentOutputDirectory();
std::string::size_type pos = parentList.rfind('/');
this->SetCurrentDirectory(parentList.substr(0, pos).c_str());
this->SetCurrentOutputDirectory
((m_HomeOutputDirectory +
parentList.substr(m_cmHomeDirectory.size(),
pos - m_cmHomeDirectory.size())).c_str());
// if not found, oops
if(pos == std::string::npos)
{
cmSystemTools::Error("Trailing slash not found");
}
this->ReadListFile(parentList.c_str());
// restore the current directory
this->SetCurrentDirectory(srcdir.c_str());
this->SetCurrentOutputDirectory(bindir.c_str());
}
}
// are we at the start CMakeLists file or are we processing a parent
// lists file
//
// this might, or might not be true, irrespective if we are
// off looking at an external makefile.
m_Inheriting = (m_cmCurrentDirectory != m_cmStartDirectory);
// Now read the input file // Now read the input file
const char *filenametoread= filename; const char *filenametoread= filename;
@ -833,6 +782,36 @@ void cmMakefile::AddLinkDirectory(const char* dir)
} }
} }
void cmMakefile::InitializeFromParent()
{
cmMakefile *parent = m_LocalGenerator->GetParent()->GetMakefile();
// copy the definitions
this->m_Definitions = parent->m_Definitions;
// copy include paths
this->m_IncludeDirectories = parent->m_IncludeDirectories;
// define flags
this->m_DefineFlags = parent->m_DefineFlags;
// link libraries
this->m_LinkLibraries = parent->m_LinkLibraries;
// the initial project name
this->m_ProjectName = parent->m_ProjectName;
}
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
{
// copy our variables from the child makefile
lg2->GetMakefile()->InitializeFromParent();
lg2->GetMakefile()->MakeStartDirectoriesCurrent();
// finally configure the subdir
lg2->Configure();
}
void cmMakefile::AddSubDirectory(const char* sub, bool topLevel, bool preorder) void cmMakefile::AddSubDirectory(const char* sub, bool topLevel, bool preorder)
{ {
// the source path must be made full if it isn't already // the source path must be made full if it isn't already
@ -854,31 +833,43 @@ void cmMakefile::AddSubDirectory(const char* sub, bool topLevel, bool preorder)
} }
this->AddSubDirectory(srcPath.c_str(), binPath.c_str(), topLevel, preorder); this->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
topLevel, preorder, false);
} }
void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
bool topLevel, bool preorder) bool topLevel, bool preorder,
bool immediate)
{ {
std::vector<cmLocalGenerator *>& children = m_LocalGenerator->GetChildren();
// has this directory already been added? If so error // has this directory already been added? If so error
unsigned int i; unsigned int i;
for (i = 0; i < m_SubDirectories.size(); ++i) for (i = 0; i < children.size(); ++i)
{ {
if (m_SubDirectories[i].SourcePath == srcPath) if (srcPath == children[i]->GetMakefile()->GetStartDirectory())
{ {
cmSystemTools::Error("Attempt to add subdirectory multiple times for directory.\n", srcPath); cmSystemTools::Error("Attempt to add subdirectory multiple times for directory.\n", srcPath);
return; return;
} }
} }
// now add it // create a new local generator and set its parent
cmSubDirectory s; cmLocalGenerator *lg2 =
s.SourcePath = srcPath; m_LocalGenerator->GetGlobalGenerator()->CreateLocalGenerator();
s.BinaryPath = binPath; lg2->SetParent(m_LocalGenerator);
s.IncludeTopLevel = topLevel; m_LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2);
s.PreOrder = preorder;
m_SubDirectories.push_back(s); // set the subdirs start dirs
lg2->GetMakefile()->SetStartDirectory(srcPath);
lg2->GetMakefile()->SetStartOutputDirectory(binPath);
lg2->SetExcludeAll(!topLevel);
lg2->GetMakefile()->SetPreOrder(preorder);
if (immediate)
{
this->ConfigureSubDirectory(lg2);
}
} }
void cmMakefile::AddIncludeDirectory(const char* inc, bool before) void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
@ -1212,110 +1203,6 @@ void cmMakefile::AddExtraDirectory(const char* dir)
m_AuxSourceDirectories.push_back(dir); m_AuxSourceDirectories.push_back(dir);
} }
// return the file name for a parent CMakeLists file. It will return the
// parent to the CMakeLists file to the m_CurrentDirectory
std::string cmMakefile::GetParentListFileName()
{
std::string parentFile;
bool done = false;
cmLocalGenerator *lg = m_LocalGenerator;
cmLocalGenerator *lgp = 0;
while (!done)
{
// first find the lg for the current directory
if (!strcmp(lg->GetMakefile()->GetStartDirectory(),
this->GetCurrentDirectory()))
{
// now get the parent
lgp = lg->GetParent();
done = true;
}
else
{
lg = lg->GetParent();
if (!lg)
{
return parentFile;
}
}
}
// if we are the top then stop
if (!lgp)
{
return parentFile;
}
// otherwise get the list file for the parent local generator
parentFile = lgp->GetMakefile()->GetCurrentDirectory();
parentFile += "/CMakeLists.txt";
return parentFile;
}
#if 0
// return the file name for the parent CMakeLists file to the
// one passed in. Zero is returned if the CMakeLists file is the
// one in the home directory or if for some reason a parent cmake lists
// file cannot be found.
std::string cmMakefile::GetParentListFileName(const char *currentFileName)
{
// extract the directory name
std::string parentFile;
std::string listsDir = currentFileName;
std::string::size_type pos = listsDir.rfind('/');
// if we could not find the directory return 0
if(pos == std::string::npos)
{
return parentFile;
}
listsDir = listsDir.substr(0, pos);
// if we are in the home directory then stop, return 0
if(m_cmHomeDirectory == listsDir)
{
return parentFile;
}
// is there a parent directory we can check
pos = listsDir.rfind('/');
// if we could not find the directory return 0
if(pos == std::string::npos)
{
return parentFile;
}
listsDir = listsDir.substr(0, pos);
// is there a CMakeLists.txt file in the parent directory ?
parentFile = listsDir;
parentFile += "/CMakeLists.txt";
while(!cmSystemTools::FileExists(parentFile.c_str()))
{
// There is no CMakeLists.txt file in the parent directory. This
// can occur when coming out of a subdirectory resulting from a
// SUBDIRS(Foo/Bar) command (coming out of Bar into Foo). Try
// walking up until a CMakeLists.txt is found or the home
// directory is hit.
// if we are in the home directory then stop, return 0
if(m_cmHomeDirectory == listsDir) { return ""; }
// is there a parent directory we can check
pos = listsDir.rfind('/');
// if we could not find the directory return 0
if(pos == std::string::npos) { return ""; }
listsDir = listsDir.substr(0, pos);
parentFile = listsDir;
parentFile += "/CMakeLists.txt";
}
return parentFile;
}
#endif
// expance CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the // expance CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the
// include and library directories. // include and library directories.

View File

@ -24,8 +24,6 @@
#include "cmListFileCache.h" #include "cmListFileCache.h"
#include "cmCacheManager.h" #include "cmCacheManager.h"
#include "cmSubDirectory.h"
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
class cmFunctionBlocker; class cmFunctionBlocker;
@ -215,8 +213,14 @@ public:
*/ */
void AddSubDirectory(const char*, bool includeTopLevel=true, bool preorder = false); void AddSubDirectory(const char*, bool includeTopLevel=true, bool preorder = false);
void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir, void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir,
bool includeTopLevel=true, bool preorder = false); bool includeTopLevel, bool preorder,
bool immediate);
/**
* Configure a subdirectory
*/
void ConfigureSubDirectory(cmLocalGenerator *);
/** /**
* Add an include directory to the build. * Add an include directory to the build.
*/ */
@ -417,13 +421,6 @@ public:
const cmTargets &GetTargets() const { return m_Targets; } const cmTargets &GetTargets() const { return m_Targets; }
cmTarget* FindTarget(const char* name); cmTarget* FindTarget(const char* name);
/**
* Get a list of the build subdirectories.
*/
const std::vector<cmSubDirectory>& GetSubDirectories()
{
return m_SubDirectories;
}
/** /**
* Get a list of include directories in the build. * Get a list of include directories in the build.
@ -662,6 +659,14 @@ public:
const char *GetProperty(const char *prop) const; const char *GetProperty(const char *prop) const;
bool GetPropertyAsBool(const char *prop) const; bool GetPropertyAsBool(const char *prop) const;
typedef std::map<cmStdString, cmStdString> DefinitionMap;
///! Initialize a makefile from its parent
void InitializeFromParent();
///! Set/Get the preorder flag
void SetPreOrder(bool p) { this->PreOrder = p; }
bool GetPreOrder() { return this->PreOrder; }
protected: protected:
// add link libraries and directories to the target // add link libraries and directories to the target
void AddGlobalLinkInformation(const char* name, cmTarget& target); void AddGlobalLinkInformation(const char* name, cmTarget& target);
@ -684,12 +689,6 @@ protected:
cmTargets m_Targets; cmTargets m_Targets;
std::vector<cmSourceFile*> m_SourceFiles; std::vector<cmSourceFile*> m_SourceFiles;
// list of sub directories
std::vector<cmSubDirectory> m_SubDirectories;
struct StringSet : public std::set<cmStdString>
{
};
// The include and link-library paths. These may have order // The include and link-library paths. These may have order
// dependency, so they must be vectors (not set). // dependency, so they must be vectors (not set).
std::vector<std::string> m_IncludeDirectories; std::vector<std::string> m_IncludeDirectories;
@ -706,17 +705,12 @@ protected:
std::vector<std::string> m_HeaderFileExtensions; std::vector<std::string> m_HeaderFileExtensions;
std::string m_DefineFlags; std::string m_DefineFlags;
std::vector<cmSourceGroup> m_SourceGroups; std::vector<cmSourceGroup> m_SourceGroups;
typedef std::map<cmStdString, cmStdString> DefinitionMap;
DefinitionMap m_Definitions; DefinitionMap m_Definitions;
std::vector<cmCommand*> m_UsedCommands; std::vector<cmCommand*> m_UsedCommands;
cmLocalGenerator* m_LocalGenerator; cmLocalGenerator* m_LocalGenerator;
bool IsFunctionBlocked(const cmListFileFunction& lff); bool IsFunctionBlocked(const cmListFileFunction& lff);
private: private:
/**
* Get the name of the parent generator's CMakeLists file
*/
std::string GetParentListFileName();
void ReadSources(std::ifstream& fin, bool t); void ReadSources(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access friend class cmMakeDepend; // make depend needs direct access
@ -728,7 +722,6 @@ private:
typedef std::map<cmStdString, cmData*> DataMap; typedef std::map<cmStdString, cmData*> DataMap;
DataMap m_DataMap; DataMap m_DataMap;
bool m_Inheriting;
typedef std::map<cmStdString, cmStdString> StringStringMap; typedef std::map<cmStdString, cmStdString> StringStringMap;
StringStringMap m_MacrosMap; StringStringMap m_MacrosMap;
@ -740,6 +733,9 @@ private:
cmsys::RegularExpression m_cmDefineRegex; cmsys::RegularExpression m_cmDefineRegex;
std::map<cmStdString,cmStdString> m_Properties; std::map<cmStdString,cmStdString> m_Properties;
// should this makefile be processed before or after processing the parent
bool PreOrder;
}; };

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -49,15 +49,6 @@ public:
*/ */
virtual const char* GetName() {return "PROJECT";} virtual const char* GetName() {return "PROJECT";}
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited()
{
return true;
}
/** /**
* Succinct documentation. * Succinct documentation.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -42,12 +42,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -33,12 +33,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -41,12 +41,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -47,15 +47,6 @@ public:
*/ */
virtual const char* GetName() {return "SOURCE_GROUP";} virtual const char* GetName() {return "SOURCE_GROUP";}
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited()
{
return true;
}
/** /**
* Succinct documentation. * Succinct documentation.
*/ */

View File

@ -40,12 +40,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -51,7 +51,7 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
std::string(m_Makefile->GetCurrentOutputDirectory()) + std::string(m_Makefile->GetCurrentOutputDirectory()) +
"/" + i->c_str(); "/" + i->c_str();
m_Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(), m_Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
intoplevel, preorder); intoplevel, preorder, false);
} }
// otherwise it is a full path // otherwise it is a full path
else if ( cmSystemTools::FileIsDirectory(i->c_str()) ) else if ( cmSystemTools::FileIsDirectory(i->c_str()) )
@ -62,7 +62,7 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
std::string(m_Makefile->GetCurrentOutputDirectory()) + std::string(m_Makefile->GetCurrentOutputDirectory()) +
"/" + cmSystemTools::GetFilenameName(i->c_str()); "/" + cmSystemTools::GetFilenameName(i->c_str());
m_Makefile->AddSubDirectory(i->c_str(), binPath.c_str(), m_Makefile->AddSubDirectory(i->c_str(), binPath.c_str(),
intoplevel, preorder); intoplevel, preorder, false);
} }
else else
{ {

View File

@ -45,12 +45,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const& args); 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. * The name of the command as specified in CMakeList.txt.
*/ */

View File

@ -69,12 +69,6 @@ public:
*/ */
virtual bool InitialPass(std::vector<std::string> const&) { return false; } 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. * This determines if the command is invoked when in script mode.
*/ */

View File

@ -1,3 +1,6 @@
# a simple test case # a simple test case
PROJECT (OutOfSource) PROJECT (OutOfSource)
SUBDIRS(SubDir)
ADD_SUBDIRECTORY(SubDir)
SET(KEN 1)

View File

@ -1,2 +1,3 @@
# subdir to a sibling dir # subdir to a sibling dir
SUBDIRS(${PROJECT_SOURCE_DIR}/OutOfSourceSubdir) MESSAGE ("Ken is ${KEN}")
SUBDIRS(${PROJECT_SOURCE_DIR}/${KEN}OutOfSourceSubdir)