summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-03-18 10:41:41 -0500
committerKen Martin <ken.martin@kitware.com>2005-03-18 10:41:41 -0500
commit345cf0401235a1fd64bb9b1c353e0e3fc848d666 (patch)
tree6c1862e3516cd436f3068221ae9fcc11144724b8 /Source
parent1f9df24ba7e76cbd7ecc1816a9f8d46b61816e95 (diff)
downloadcmake-345cf0401235a1fd64bb9b1c353e0e3fc848d666.tar.gz
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')
-rw-r--r--Source/cmAddDefinitionsCommand.h6
-rw-r--r--Source/cmAddTestCommand.cxx2
-rw-r--r--Source/cmBootstrapCommands.cxx2
-rw-r--r--Source/cmBuildCommand.h6
-rw-r--r--Source/cmBuildNameCommand.h6
-rw-r--r--Source/cmCMakeMinimumRequired.h6
-rw-r--r--Source/cmCommand.h9
-rw-r--r--Source/cmCreateTestSourceList.h6
-rw-r--r--Source/cmElseCommand.h6
-rw-r--r--Source/cmEnableLanguageCommand.h9
-rw-r--r--Source/cmEnableTestingCommand.cxx46
-rw-r--r--Source/cmEnableTestingCommand.h10
-rw-r--r--Source/cmEndForEachCommand.h6
-rw-r--r--Source/cmEndIfCommand.h6
-rw-r--r--Source/cmEndWhileCommand.h6
-rw-r--r--Source/cmFileCommand.h6
-rw-r--r--Source/cmFindFileCommand.h6
-rw-r--r--Source/cmFindLibraryCommand.h6
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmFindPackageCommand.h3
-rw-r--r--Source/cmFindPathCommand.h6
-rw-r--r--Source/cmFindProgramCommand.h6
-rw-r--r--Source/cmForEachCommand.h6
-rw-r--r--Source/cmGetFilenameComponentCommand.h6
-rw-r--r--Source/cmGlobalGenerator.cxx90
-rw-r--r--Source/cmGlobalGenerator.h5
-rw-r--r--Source/cmIfCommand.h6
-rw-r--r--Source/cmIncludeCommand.h6
-rw-r--r--Source/cmIncludeDirectoryCommand.h6
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h9
-rw-r--r--Source/cmLinkDirectoriesCommand.h6
-rw-r--r--Source/cmLinkLibrariesCommand.h6
-rw-r--r--Source/cmLoadCacheCommand.h6
-rw-r--r--Source/cmLoadCommandCommand.cxx8
-rw-r--r--Source/cmLoadCommandCommand.h6
-rw-r--r--Source/cmLocalGenerator.cxx29
-rw-r--r--Source/cmLocalGenerator.h17
-rw-r--r--Source/cmLocalKdevelopGenerator.cxx6
-rw-r--r--Source/cmLocalKdevelopGenerator.h1
-rw-r--r--Source/cmLocalUnixMakefileGenerator2.cxx26
-rw-r--r--Source/cmLocalUnixMakefileGenerator2.h8
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio6Generator.h8
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.h8
-rw-r--r--Source/cmMacroCommand.cxx403
-rw-r--r--Source/cmMacroCommand.h9
-rw-r--r--Source/cmMakefile.cxx259
-rw-r--r--Source/cmMakefile.h40
-rw-r--r--Source/cmMarkAsAdvancedCommand.h6
-rw-r--r--Source/cmOptionCommand.h6
-rw-r--r--Source/cmProjectCommand.h9
-rw-r--r--Source/cmRemoveCommand.h6
-rw-r--r--Source/cmRemoveDefinitionsCommand.h6
-rw-r--r--Source/cmSeparateArgumentsCommand.h6
-rw-r--r--Source/cmSetCommand.h6
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h6
-rw-r--r--Source/cmSiteNameCommand.h6
-rw-r--r--Source/cmSourceGroupCommand.h9
-rw-r--r--Source/cmStringCommand.h6
-rw-r--r--Source/cmSubdirCommand.cxx4
-rw-r--r--Source/cmUtilitySourceCommand.h6
-rw-r--r--Source/cmWhileCommand.h6
63 files changed, 465 insertions, 774 deletions
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index 7b632214c4..f2ab1a39dd 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -43,12 +43,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.
*/
virtual const char* GetName() {return "ADD_DEFINITIONS";}
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index ec04928b3d..28ee2d72a4 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -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();
diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx
index b093cde5d0..776b7657c8 100644
--- a/Source/cmBootstrapCommands.cxx
+++ b/Source/cmBootstrapCommands.cxx
@@ -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);
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index d07b169db7..255f47492c 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -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.
*/
virtual const char* GetName() {return "BUILD_COMMAND";}
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 79a1845930..1cd6369580 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -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.
*/
virtual const char* GetName() {return "BUILD_NAME";}
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index c947644705..05f2f1a407 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -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;}
-
- /**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 5380b5a007..2f5fc7e672 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -82,15 +82,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.
*/
virtual bool IsScriptable()
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 850c2bc3e3..a258654941 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -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.
*/
virtual const char* GetName() {return "CREATE_TEST_SOURCELIST";}
diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h
index fa2b36b8ef..a085cef4cb 100644
--- a/Source/cmElseCommand.h
+++ b/Source/cmElseCommand.h
@@ -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;}
-
- /**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 2d8106cb78..b8965ab2e9 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -50,15 +50,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.
*/
virtual const char* GetTerseDocumentation()
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx
index 3b717cdbfd..36625965c9 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;
}
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index d03b218966..3c5f01bc97 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -44,12 +44,6 @@ public:
}
/**
- * 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);
+
};
diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h
index 3a65df93ad..e50a9110c8 100644
--- a/Source/cmEndForEachCommand.h
+++ b/Source/cmEndForEachCommand.h
@@ -48,12 +48,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h
index 230637d45b..467f95ca12 100644
--- a/Source/cmEndIfCommand.h
+++ b/Source/cmEndIfCommand.h
@@ -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;}
-
- /**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h
index 0b401e79fa..15cb1f2415 100644
--- a/Source/cmEndWhileCommand.h
+++ b/Source/cmEndWhileCommand.h
@@ -48,12 +48,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 5d00acfdbe..71bca90917 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 21c07eb000..12d1f75f63 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -45,12 +45,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 42fc3bdd03..b5f0f7beb8 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -45,12 +45,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9c2aa334ff..c917ecc2b6 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -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;
}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 8a90a1d3fa..144941d4c4 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -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.
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index bafc450699..6553ca0d5e 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -45,12 +45,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 83d840b57a..dd2aa10133 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -45,12 +45,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 64602c9dbf..668172918d 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -64,12 +64,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index 4aee4721fc..fe490ddbda 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -43,12 +43,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 9dc56c890a..89848315f4 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -18,7 +18,6 @@
#include "cmLocalGenerator.h"
#include "cmake.h"
#include "cmMakefile.h"
-#include "cmSubDirectory.h"
#include <stdlib.h> // required for atof
@@ -492,13 +491,24 @@ void cmGlobalGenerator::Configure()
m_LocalGenerators.push_back(lg);
// set the Start directories
- lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory());
- lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory());
+ lg->GetMakefile()->SetStartDirectory
+ (m_CMakeInstance->GetStartDirectory());
+ lg->GetMakefile()->SetStartOutputDirectory
+ (m_CMakeInstance->GetStartOutputDirectory());
lg->GetMakefile()->MakeStartDirectoriesCurrent();
// 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;
// after it is all done do a ConfigureFinalPass
cmCacheManager* manager = 0;
@@ -506,7 +516,8 @@ void cmGlobalGenerator::Configure()
{
manager = m_LocalGenerators[i]->GetMakefile()->GetCacheManager();
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();
l != targets.end(); l++)
{
@@ -535,7 +546,7 @@ void cmGlobalGenerator::Configure()
}
}
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();
}
}
@@ -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()
{
// For each existing cmLocalGenerator
unsigned int i;
for (i = 0; i < m_LocalGenerators.size(); ++i)
{
- m_LocalGenerators[i]->Generate(true);
+ m_LocalGenerators[i]->Generate();
m_LocalGenerators[i]->GenerateInstallRules();
m_CMakeInstance->UpdateProgress("Generating",
(i+1.0f)/m_LocalGenerators.size());
@@ -753,6 +725,30 @@ int cmGlobalGenerator::Build(
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 *lg = new cmLocalGenerator;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index a16b88c2d4..4ca2be69e0 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -109,6 +109,8 @@ public:
void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;}
+ void AddLocalGenerator(cmLocalGenerator *lg);
+
static int s_TryCompileTimeout;
bool GetForceUnixPaths() {return m_ForceUnixPaths;}
@@ -149,9 +151,6 @@ protected:
// map from project name to vector of local generators in that project
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.
cmTarget* FindTarget(const char* project, const char* name);
private:
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index af6dc7b362..44d8558602 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -82,12 +82,6 @@ public:
}
/**
- * 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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 8df9a36fed..2a7a726c9d 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -45,12 +45,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index 9031c3cc88..0249f9f57f 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -43,12 +43,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.
*/
virtual const char* GetName() { return "INCLUDE_DIRECTORIES";}
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index c80414dff2..f7fc412ed3 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -49,15 +49,6 @@ public:
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.
*/
virtual const char* GetTerseDocumentation()
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index d7934fe057..cb88cd91ea 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -45,12 +45,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.
*/
virtual const char* GetName() { return "LINK_DIRECTORIES";}
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index c9b7c53b45..bd6e80e15d 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -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 true;}
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "LINK_LIBRARIES";}
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index 40d6cf8efa..24892bb23f 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -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.
*/
virtual const char* GetName() { return "LOAD_CACHE";}
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index fcdc045bef..db3b6c5f02 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -60,14 +60,6 @@ public:
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.
*/
virtual const char* GetName() { return info.Name; }
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index aae0342146..1ffb2259d8 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -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.
*/
virtual const char* GetName() {return "LOAD_COMMAND";}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 504b624e76..f5046474f1 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -20,7 +20,6 @@
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmSourceFile.h"
-#include "cmSubDirectory.h"
#include "cmOrderLinkDirectories.h"
cmLocalGenerator::cmLocalGenerator()
@@ -32,6 +31,7 @@ cmLocalGenerator::cmLocalGenerator()
m_WindowsShell = false;
m_IgnoreLibPrefix = false;
m_UseRelativePaths = false;
+ this->Configured = false;
}
cmLocalGenerator::~cmLocalGenerator()
@@ -53,6 +53,20 @@ void cmLocalGenerator::Configure()
currentStart += "/CMakeLists.txt";
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
// ConvertToRelativePath.
std::string outdir =
@@ -62,6 +76,8 @@ void cmLocalGenerator::Configure()
// Check whether relative paths should be used for optionally
// relative paths.
m_UseRelativePaths = m_Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS");
+
+ this->Configured = true;
}
void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
@@ -316,14 +332,13 @@ void cmLocalGenerator::GenerateInstallRules()
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<cmSubDirectory>::const_iterator i = subdirs.begin();
- for(; i != subdirs.end(); ++i)
+ std::vector<cmLocalGenerator*>::const_iterator i = this->Children.begin();
+ for(; i != this->Children.end(); ++i)
{
- std::string odir = i->BinaryPath;
+ std::string odir = (*i)->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ConvertToUnixSlashes(odir);
fout << "INCLUDE(\"" << odir.c_str()
<< "/cmake_install.cmake\")" << std::endl;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 0ff37252ac..8d3009ba5b 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -39,13 +39,9 @@ public:
virtual ~cmLocalGenerator();
/**
- * Generate the makefile for this directory. fromTheTop indicates if this
- * 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.
+ * Generate the makefile for this directory.
*/
- virtual void Generate(bool /* fromTheTop */) {};
+ virtual void Generate() {};
/**
* Process the CMakeLists files for this directory to fill in the
@@ -118,7 +114,12 @@ public:
///! set/get the parent generator
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 AddSharedFlags(std::string& flags, const char* lang, bool shared);
@@ -185,10 +186,12 @@ protected:
std::vector<std::string> m_CurrentOutputDirectoryComponents;
bool m_ExcludeFromAll;
cmLocalGenerator* m_Parent;
+ std::vector<cmLocalGenerator*> Children;
std::map<cmStdString, cmStdString> m_LanguageToIncludeFlags;
bool m_WindowsShell;
bool m_UseRelativePaths;
bool m_IgnoreLibPrefix;
+ bool Configured;
};
#endif
diff --git a/Source/cmLocalKdevelopGenerator.cxx b/Source/cmLocalKdevelopGenerator.cxx
index ae517a3f93..c7846d844d 100644
--- a/Source/cmLocalKdevelopGenerator.cxx
+++ b/Source/cmLocalKdevelopGenerator.cxx
@@ -36,9 +36,3 @@ cmLocalKdevelopGenerator::~cmLocalKdevelopGenerator()
{
}
-
-void cmLocalKdevelopGenerator::Generate(bool fromTheTop)
-{
- cmLocalUnixMakefileGenerator2::Generate(fromTheTop);
- return;
-}
diff --git a/Source/cmLocalKdevelopGenerator.h b/Source/cmLocalKdevelopGenerator.h
index 1874295ced..910768abbc 100644
--- a/Source/cmLocalKdevelopGenerator.h
+++ b/Source/cmLocalKdevelopGenerator.h
@@ -35,7 +35,6 @@ public:
virtual ~cmLocalKdevelopGenerator();
- virtual void Generate(bool fromTheTop);
};
#endif
diff --git a/Source/cmLocalUnixMakefileGenerator2.cxx b/Source/cmLocalUnixMakefileGenerator2.cxx
index 58053a2099..840b439914 100644
--- a/Source/cmLocalUnixMakefileGenerator2.cxx
+++ b/Source/cmLocalUnixMakefileGenerator2.cxx
@@ -21,7 +21,6 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmSubDirectory.h"
#include "cmake.h"
// 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.
this->ConfigureOutputPaths();
@@ -1314,24 +1305,25 @@ cmLocalUnixMakefileGenerator2
// boolean is true should be included. Keep track of the last
// pre-order and last post-order rule created so that ordering can
// be enforced.
- const std::vector<cmSubDirectory>& subdirs = m_Makefile->GetSubDirectories();
std::string lastPre = "";
std::string lastPost = "";
- for(std::vector<cmSubDirectory>::const_iterator
- i = subdirs.begin(); i != subdirs.end(); ++i)
+ for(std::vector<cmLocalGenerator*>::const_iterator
+ 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.
- if(i->PreOrder)
+ if((*i)->GetMakefile()->GetPreOrder())
{
this->WriteSubdirRule(makefileStream, pass,
- i->BinaryPath.c_str(), lastPre);
+ (*i)->GetMakefile()->GetStartOutputDirectory(),
+ lastPre);
}
else
{
this->WriteSubdirRule(makefileStream, pass,
- i->BinaryPath.c_str(), lastPost);
+ (*i)->GetMakefile()->GetStartOutputDirectory(),
+ lastPost);
}
}
}
diff --git a/Source/cmLocalUnixMakefileGenerator2.h b/Source/cmLocalUnixMakefileGenerator2.h
index 2026abd09e..63cdc4cc09 100644
--- a/Source/cmLocalUnixMakefileGenerator2.h
+++ b/Source/cmLocalUnixMakefileGenerator2.h
@@ -85,13 +85,9 @@ public:
void SetPassMakeflags(bool s){m_PassMakeflags = s;}
/**
- * Generate the makefile for this directory. fromTheTop indicates if this
- * 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.
+ * Generate the makefile for this directory.
*/
- virtual void Generate(bool fromTheTop);
+ virtual void Generate();
/** Called from command-line hook to scan dependencies. */
static bool ScanDependencies(std::vector<std::string> const& args);
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index e86983eb73..5c73194d09 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -33,7 +33,7 @@ cmLocalVisualStudio6Generator::~cmLocalVisualStudio6Generator()
}
-void cmLocalVisualStudio6Generator::Generate(bool /* fromTheTop */)
+void cmLocalVisualStudio6Generator::Generate()
{
std::set<cmStdString> lang;
lang.insert("C");
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index f4cee58d87..6e3d459f2f 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -40,13 +40,9 @@ public:
virtual ~cmLocalVisualStudio6Generator();
/**
- * Generate the makefile for this directory. fromTheTop indicates if this
- * 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.
+ * Generate the makefile for this directory.
*/
- virtual void Generate(bool fromTheTop);
+ virtual void Generate();
void OutputDSPFile();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index a0d1cec4ab..4fa4497fc4 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -32,7 +32,7 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
}
-void cmLocalVisualStudio7Generator::Generate(bool /* fromTheTop */)
+void cmLocalVisualStudio7Generator::Generate()
{
std::set<cmStdString> lang;
lang.insert("C");
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index a6608bc6d2..0821d3645c 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -41,13 +41,9 @@ public:
virtual ~cmLocalVisualStudio7Generator();
/**
- * Generate the makefile for this directory. fromTheTop indicates if this
- * 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.
+ * Generate the makefile for this directory.
*/
- virtual void Generate(bool fromTheTop);
+ virtual void Generate();
enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 9db5f168d1..daf3989ac8 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -16,214 +16,287 @@
=========================================================================*/
#include "cmMacroCommand.h"
-bool cmMacroFunctionBlocker::
-IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
+// define the class for macro commands
+class cmMacroHelperCommand : public cmCommand
{
- // record commands until we hit the ENDMACRO
- if (!m_Executing)
+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)
{
- // 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;
+ std::string errorMsg =
+ "Macro invoked with incorrect arguments for macro named: ";
+ errorMsg += m_Args[0];
+ this->SetError(errorMsg.c_str());
+ return false;
}
- // otherwise the macro has been recorded and we are executing
- // so we look for macro invocations
- if(lff.m_Name == m_Args[0])
+ // 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)
{
- std::string tmps;
- cmListFileArgument arg;
- std::string variable;
- // Expand the argument list to the macro.
- std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.m_Arguments, expandedArguments);
-
- // make sure the number of arguments passed is at least the number
- // required by the signature
- if (expandedArguments.size() < m_Args.size() - 1)
+ // 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)
{
- cmOStringStream error;
- error << "Error in cmake code at\n"
- << lff.m_FilePath << ":" << lff.m_Line << ":\n"
- << "Invocation of macro \""
- << lff.m_Name.c_str() << "\" with incorrect number of arguments.";
- cmSystemTools::Error(error.str().c_str());
- 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)
{
- 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)
+ 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)
{
- 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 )
{
- 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 ( cnt >= m_Args.size()-1 )
+ if ( argnDef.size() > 0 )
{
- if ( argnDef.size() > 0 )
- {
- argnDef += ";";
- }
- argnDef += *eit;
+ argnDef += ";";
}
- cnt ++;
+ argnDef += *eit;
}
- argnDefInitialized = true;
+ cnt ++;
}
- cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
+ 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];
- // if the current argument of the current function has ${ARGV in it
- // then try replacing ARGV values
- if (tmps.find("${ARGV") != std::string::npos)
+ // repleace ARGV, compute it only once
+ if (!argvDefInitialized)
{
- 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 )
{
- std::vector<std::string>::iterator eit;
- for ( eit = expandedArguments.begin();
- eit != expandedArguments.end();
- ++ eit )
+ if ( argvDef.size() > 0 )
{
- if ( argvDef.size() > 0 )
- {
- argvDef += ";";
- }
- argvDef += *eit;
+ argvDef += ";";
}
- 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());
+ argvDef += *eit;
}
+ argvDefInitialized = true;
}
+ cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
- arg.Value = tmps;
- arg.Quoted = k->Quoted;
- const char* def =
- mf.GetDefinition("CMAKE_MACRO_REPORT_DEFINITION_LOCATION");
- if(def && !cmSystemTools::IsOff(def))
+ // also replace the ARGV1 ARGV2 ... etc
+ for (unsigned int t = 0; t < expandedArgs.size(); ++t)
{
- // Report the location of the argument where the macro was
- // defined.
- arg.FilePath = k->FilePath;
- arg.Line = k->Line;
+ 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
{
- // Report the location of the argument where the macro was
- // invoked.
- arg.FilePath = lff.m_FilePath;
- arg.Line = lff.m_Line;
+ arg.FilePath = "Unknown";
+ arg.Line = 0;
}
- newLFF.m_Arguments.push_back(arg);
}
- if(!mf.ExecuteCommand(newLFF))
+ 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::
+IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
+{
+ // record commands until we hit the 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]))
+ {
+ std::string name = m_Args[0];
+ std::vector<std::string>::size_type cc;
+ name += "(";
+ for ( cc = 0; cc < m_Args.size(); cc ++ )
{
- 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());
+ 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;
}
-
- // if not an invocation then it is just an ordinary line
- return false;
+
+ // if it wasn't an endmacro and we are not executing then we must be
+ // recording
+ m_Functions.push_back(lff);
+ return true;
}
+
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;
}
void cmMacroFunctionBlocker::
ScopeEnded(cmMakefile &mf)
{
- // macros never leave scope but we should have seen the ENDMACRO call by now
- 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 ",
- m_Args[0].c_str());
- }
+ // macros should end with an EndMacro
+ 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 ",
+ m_Args[0].c_str());
}
bool cmMacroCommand::InitialPass(std::vector<std::string> const& args)
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index b0848d1c56..26d0f85e52 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -28,7 +28,7 @@
class cmMacroFunctionBlocker : public cmFunctionBlocker
{
public:
- cmMacroFunctionBlocker() {m_Executing = false;}
+ cmMacroFunctionBlocker() {}
virtual ~cmMacroFunctionBlocker() {}
virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile &mf);
virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf);
@@ -36,7 +36,6 @@ public:
std::vector<std::string> m_Args;
std::vector<cmListFileFunction> m_Functions;
- bool m_Executing;
};
/** \class cmMacroCommand
@@ -62,12 +61,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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c3d711cba2..05c165ddb7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -73,7 +73,9 @@ cmMakefile::cmMakefile()
this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddDefaultDefinitions();
m_cmDefineRegex.compile("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
- }
+
+ this->PreOrder = false;
+}
const char* cmMakefile::GetReleaseVersion()
{
@@ -248,30 +250,25 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
(!this->GetCMakeInstance()->GetScriptMode() ||
usedCommand->IsScriptable()))
{
- // if not running in inherit mode or
- // if the command is inherited then InitialPass it.
- if(!m_Inheriting || usedCommand->IsInherited())
+ if(!usedCommand->InvokeInitialPass(lff.m_Arguments))
{
- 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() )
- {
- cmSystemTools::SetFatalErrorOccured();
- }
- }
- else
+ 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() )
{
- // use the command
- keepCommand = true;
- m_UsedCommands.push_back(usedCommand);
+ cmSystemTools::SetFatalErrorOccured();
}
}
+ else
+ {
+ // use the command
+ keepCommand = true;
+ m_UsedCommands.push_back(usedCommand);
+ }
}
else if ( this->GetCMakeInstance()->GetScriptMode() && !usedCommand->IsScriptable() )
{
@@ -306,16 +303,9 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
return result;
}
-// Parse the given CMakeLists.txt file into a list of classes.
-// Reads in current CMakeLists file and all parent CMakeLists files
-// executing all inherited commands in the parents
+// Parse the given CMakeLists.txt file executing all commands
//
-// if external is non-zero, this means that we have branched to grab some
-// 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)
+bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in)
{
// used to watch for blockers going out of scope
// 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
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)
{
// 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,
- 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
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);
return;
}
}
- // now add it
- cmSubDirectory s;
- s.SourcePath = srcPath;
- s.BinaryPath = binPath;
- s.IncludeTopLevel = topLevel;
- s.PreOrder = preorder;
- m_SubDirectories.push_back(s);
+ // create a new local generator and set its parent
+ cmLocalGenerator *lg2 =
+ m_LocalGenerator->GetGlobalGenerator()->CreateLocalGenerator();
+ lg2->SetParent(m_LocalGenerator);
+ m_LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2);
+
+ // 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)
@@ -1212,110 +1203,6 @@ void cmMakefile::AddExtraDirectory(const char* 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
// include and library directories.
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 2fed10dd1c..3bb7a290b9 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -24,8 +24,6 @@
#include "cmListFileCache.h"
#include "cmCacheManager.h"
-#include "cmSubDirectory.h"
-
#include <cmsys/RegularExpression.hxx>
class cmFunctionBlocker;
@@ -215,9 +213,15 @@ public:
*/
void AddSubDirectory(const char*, bool includeTopLevel=true, bool preorder = false);
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.
*/
void AddIncludeDirectory(const char*, bool before = false);
@@ -417,13 +421,6 @@ public:
const cmTargets &GetTargets() const { return m_Targets; }
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.
@@ -662,6 +659,14 @@ public:
const char *GetProperty(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:
// add link libraries and directories to the target
void AddGlobalLinkInformation(const char* name, cmTarget& target);
@@ -684,12 +689,6 @@ protected:
cmTargets m_Targets;
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
// dependency, so they must be vectors (not set).
std::vector<std::string> m_IncludeDirectories;
@@ -706,17 +705,12 @@ protected:
std::vector<std::string> m_HeaderFileExtensions;
std::string m_DefineFlags;
std::vector<cmSourceGroup> m_SourceGroups;
- typedef std::map<cmStdString, cmStdString> DefinitionMap;
DefinitionMap m_Definitions;
std::vector<cmCommand*> m_UsedCommands;
cmLocalGenerator* m_LocalGenerator;
bool IsFunctionBlocked(const cmListFileFunction& lff);
private:
- /**
- * Get the name of the parent generator's CMakeLists file
- */
- std::string GetParentListFileName();
void ReadSources(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access
@@ -728,7 +722,6 @@ private:
typedef std::map<cmStdString, cmData*> DataMap;
DataMap m_DataMap;
- bool m_Inheriting;
typedef std::map<cmStdString, cmStdString> StringStringMap;
StringStringMap m_MacrosMap;
@@ -740,6 +733,9 @@ private:
cmsys::RegularExpression m_cmDefineRegex;
std::map<cmStdString,cmStdString> m_Properties;
+
+ // should this makefile be processed before or after processing the parent
+ bool PreOrder;
};
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 108faaaa4f..d3b3fe9dd3 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -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.
*/
virtual const char* GetName() {return "MARK_AS_ADVANCED";}
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 30c9eef115..2facc8eb01 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -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.
*/
virtual const char* GetName() {return "OPTION";}
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index 0deeacb594..dd4ae746af 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -50,15 +50,6 @@ public:
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.
*/
virtual const char* GetTerseDocumentation()
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 82d1592527..a1de0101b9 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -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;}
-
- /**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index ac1c75c9bf..531c223b66 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -43,12 +43,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.
*/
virtual const char* GetName() {return "REMOVE_DEFINITIONS";}
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 64d669f824..4be21f6f75 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -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;}
-
- /**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 0556053f52..5253bafc6e 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -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;}
-
- /**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index 14272354db..1bc2310138 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -34,12 +34,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.
*/
virtual const char* GetName() { return "SET_DIRECTORY_PROPERTIES";}
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index 1a3ef33363..a191032907 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -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.
*/
virtual const char* GetName() {return "SITE_NAME";}
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 337201a959..146f8b551d 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -48,15 +48,6 @@ public:
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.
*/
virtual const char* GetTerseDocumentation()
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index d392a3d00f..91463c44b8 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -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.
*/
virtual bool IsScriptable() { return true; }
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index 56cae36249..ab438924be 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -51,7 +51,7 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
std::string(m_Makefile->GetCurrentOutputDirectory()) +
"/" + i->c_str();
m_Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
- intoplevel, preorder);
+ intoplevel, preorder, false);
}
// otherwise it is a full path
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()) +
"/" + cmSystemTools::GetFilenameName(i->c_str());
m_Makefile->AddSubDirectory(i->c_str(), binPath.c_str(),
- intoplevel, preorder);
+ intoplevel, preorder, false);
}
else
{
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index bab1f6abaf..3dd58c8dfb 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -46,12 +46,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.
*/
virtual const char* GetName() { return "UTILITY_SOURCE";}
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 752867f5f2..bfb355e611 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -70,12 +70,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.
*/
virtual bool IsScriptable() { return true; }