summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CPack/cmCPackGenerator.cxx6
-rw-r--r--Source/CPack/cpack.cxx6
-rw-r--r--Source/CTest/cmCTestLaunch.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx10
-rw-r--r--Source/cmCTest.cxx7
-rw-r--r--Source/cmFindPackageCommand.cxx4
-rw-r--r--Source/cmGlobalGenerator.cxx24
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmGraphVizWriter.cxx2
-rw-r--r--Source/cmIncludeCommand.cxx7
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmMakefile.cxx141
-rw-r--r--Source/cmMakefile.h15
-rw-r--r--Source/cmProjectCommand.cxx3
-rw-r--r--Source/cmQtAutoGenerators.cxx4
-rw-r--r--Source/cmake.cxx6
18 files changed, 106 insertions, 143 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 4f37041..2b18c41 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -525,7 +525,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
tempInstallDirectory.c_str());
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
tempInstallDirectory.c_str());
- int res = this->MakefileMap->ReadListFile(0, installScript.c_str());
+ int res = this->MakefileMap->ReadListFile(installScript.c_str());
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
{
return 0;
@@ -888,7 +888,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
"1");
}
// do installation
- int res = mf->ReadListFile(0, installFile.c_str());
+ int res = mf->ReadListFile(installFile.c_str());
// forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
// to CPack (may be used by generators like CPack RPM or DEB)
// in order to transparently handle ABSOLUTE PATH
@@ -980,7 +980,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName)
{
bool retval;
std::string fullPath = this->MakefileMap->GetModulesFile(moduleName);
- retval = this->MakefileMap->ReadListFile(0, fullPath.c_str());
+ retval = this->MakefileMap->ReadListFile(fullPath.c_str());
// include FATAL_ERROR and ERROR in the return status
retval = retval && (! cmSystemTools::GetErrorOccuredFlag());
return retval;
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index a9cabf1..2752270 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -244,7 +244,7 @@ int main (int argc, char const* const* argv)
// paths, so FIND_XXX() commands can be used in scripts
std::string systemFile =
globalMF->GetModulesFile("CMakeDetermineSystem.cmake");
- if (!globalMF->ReadListFile(0, systemFile.c_str()))
+ if (!globalMF->ReadListFile(systemFile.c_str()))
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Error reading CMakeDetermineSystem.cmake" << std::endl);
@@ -253,7 +253,7 @@ int main (int argc, char const* const* argv)
systemFile =
globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake");
- if (!globalMF->ReadListFile(0, systemFile.c_str()))
+ if (!globalMF->ReadListFile(systemFile.c_str()))
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Error reading CMakeSystemSpecificInformation.cmake" << std::endl);
@@ -272,7 +272,7 @@ int main (int argc, char const* const* argv)
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack configuration file: " << cpackConfigFile
<< std::endl);
- if ( !globalMF->ReadListFile(0, cpackConfigFile.c_str()) )
+ if ( !globalMF->ReadListFile(cpackConfigFile.c_str()) )
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Problem reading CPack config file: \""
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 62fa2be..de6ecde 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -757,7 +757,7 @@ void cmCTestLaunch::LoadConfig()
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
if(cmSystemTools::FileExists(fname.c_str()) &&
- mf->ReadListFile(0, fname.c_str()))
+ mf->ReadListFile(fname.c_str()))
{
this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 783941b..7f9825c 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -433,7 +433,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
ctest scripting easier. */
std::string systemFile =
this->Makefile->GetModulesFile("CTestScriptMode.cmake");
- if (!this->Makefile->ReadListFile(0, systemFile.c_str()) ||
+ if (!this->Makefile->ReadListFile(systemFile.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:"
@@ -451,7 +451,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
}
// finally read in the script
- if (!this->Makefile->ReadListFile(0, script.c_str()) ||
+ if (!this->Makefile->ReadListFile(script.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
// Reset the error flag so that it can run more than
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index c50ea88..d778253 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -117,9 +117,7 @@ bool cmCTestSubdirCommand
}
fname += "/";
fname += testFilename;
- bool readit =
- this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
- fname.c_str());
+ bool readit = this->Makefile->ReadDependentFile(fname.c_str());
cmSystemTools::ChangeDirectory(cwd);
if(!readit)
{
@@ -205,9 +203,7 @@ bool cmCTestAddSubdirectoryCommand
}
fname += "/";
fname += testFilename;
- bool readit =
- this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
- fname.c_str());
+ bool readit = this->Makefile->ReadDependentFile(fname.c_str());
cmSystemTools::ChangeDirectory(cwd);
if(!readit)
{
@@ -1621,7 +1617,7 @@ void cmCTestTestHandler::GetListOfTests()
return;
}
- if ( !mf->ReadListFile(0, testFilename) )
+ if ( !mf->ReadListFile(testFilename) )
{
return;
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index cd2cd7c..3697aa4 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -687,8 +687,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
{
cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: "
<< fname << std::endl, command->ShouldBeQuiet());
- bool readit = mf->ReadListFile(mf->GetCurrentListFile(),
- fname.c_str() );
+ bool readit = mf->ReadDependentFile(fname.c_str());
if(!readit)
{
std::string m = "Could not find include file: ";
@@ -2577,7 +2576,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
cmSystemTools::ResetErrorOccuredFlag();
- if ( !mf->ReadListFile(0, fname.c_str()) ||
+ if ( !mf->ReadListFile(fname.c_str()) ||
cmSystemTools::GetErrorOccuredFlag() )
{
cmCTestLog(this, ERROR_MESSAGE,
@@ -2607,7 +2606,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
{
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< *fileIt << std::endl);
- if ( !mf->ReadListFile(0, fileIt->c_str()) ||
+ if ( !mf->ReadListFile(fileIt->c_str()) ||
cmSystemTools::GetErrorOccuredFlag() )
{
cmCTestLog(this, ERROR_MESSAGE,
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index e1074b0..aecd230 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -999,8 +999,8 @@ bool cmFindPackageCommand::FindAppBundleConfig()
//----------------------------------------------------------------------------
bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
{
- if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), f, 0,
- !this->PolicyScope || psr == NoPolicyScope))
+ const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
+ if(this->Makefile->ReadDependentFile(f, noPolicyScope))
{
return true;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ab044c1..4a9f628 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -278,7 +278,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
if(!setMakeProgram.empty())
{
- mf->ReadListFile(0, setMakeProgram.c_str());
+ mf->ReadListFile(setMakeProgram.c_str());
}
}
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
@@ -428,7 +428,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
fpath += "/CMakeSystem.cmake";
if(cmSystemTools::FileExists(fpath.c_str()))
{
- mf->ReadListFile(0,fpath.c_str());
+ mf->ReadListFile(fpath.c_str());
}
}
// Load the CMakeDetermineSystem.cmake file and find out
@@ -456,12 +456,12 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
#endif
// Read the DetermineSystem file
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
- mf->ReadListFile(0, systemFile.c_str());
+ mf->ReadListFile(systemFile.c_str());
// load the CMakeSystem.cmake from the binary directory
// this file is configured by the CMakeDetermineSystem.cmake file
fpath = rootBin;
fpath += "/CMakeSystem.cmake";
- mf->ReadListFile(0,fpath.c_str());
+ mf->ReadListFile(fpath.c_str());
}
if(readCMakeSystem)
@@ -495,7 +495,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED"))
{
fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake");
- if(!mf->ReadListFile(0,fpath.c_str()))
+ if(!mf->ReadListFile(fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file: "
"CMakeSystemSpecificInitialize.cmake");
@@ -533,7 +533,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// to avoid duplicate compiler tests.
if(cmSystemTools::FileExists(fpath.c_str()))
{
- if(!mf->ReadListFile(0,fpath.c_str()))
+ if(!mf->ReadListFile(fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
@@ -563,7 +563,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
determineCompiler += "Compiler.cmake";
std::string determineFile =
mf->GetModulesFile(determineCompiler.c_str());
- if(!mf->ReadListFile(0,determineFile.c_str()))
+ if(!mf->ReadListFile(determineFile.c_str()))
{
cmSystemTools::Error("Could not find cmake module file: ",
determineCompiler.c_str());
@@ -597,7 +597,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
fpath += "/CMake";
fpath += lang;
fpath += "Compiler.cmake";
- if(!mf->ReadListFile(0,fpath.c_str()))
+ if(!mf->ReadListFile(fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
@@ -616,7 +616,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
{
fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake");
- if(!mf->ReadListFile(0,fpath.c_str()))
+ if(!mf->ReadListFile(fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file: "
"CMakeSystemSpecificInformation.cmake");
@@ -707,7 +707,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
}
- else if(!mf->ReadListFile(0, informationFile.c_str()))
+ else if(!mf->ReadListFile(informationFile.c_str()))
{
cmSystemTools::Error("Could not process cmake module file: ",
informationFile.c_str());
@@ -732,7 +732,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
testLang += lang;
testLang += "Compiler.cmake";
std::string ifpath = mf->GetModulesFile(testLang.c_str());
- if(!mf->ReadListFile(0,ifpath.c_str()))
+ if(!mf->ReadListFile(ifpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file: ",
testLang.c_str());
@@ -777,7 +777,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
projectCompatibility += "Compatibility.cmake";
if(cmSystemTools::FileExists(projectCompatibility.c_str()))
{
- mf->ReadListFile(0,projectCompatibility.c_str());
+ mf->ReadListFile(projectCompatibility.c_str());
}
// Inform any extra generator of the new language.
if (this->ExtraGenerator)
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index e2b2bbd4..e268852 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -60,7 +60,7 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
fname += "/Templates";
}
fname += "/CMakeVisualStudio6Configurations.cmake";
- if(!mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str()))
+ if(!mf->ReadDependentFile(fname.c_str()))
{
cmSystemTools::Error("Cannot open ", fname.c_str(),
". Please copy this file from the main "
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index af88d1c..99542a9 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -81,7 +81,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
}
}
- if ( !mf->ReadListFile(0, inFileName) )
+ if ( !mf->ReadListFile(inFileName) )
{
cmSystemTools::Error("Problem opening GraphViz options file: ",
inFileName);
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index c15d46e..18e3585 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -130,17 +130,14 @@ bool cmIncludeCommand
gg->GenerateImportFile(fname_abs);
}
- std::string fullFilePath;
bool readit =
- this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
- fname.c_str(), &fullFilePath,
- noPolicyScope);
+ this->Makefile->ReadDependentFile(fname.c_str(), noPolicyScope);
// add the location of the included file if a result variable was given
if (!resultVarName.empty())
{
this->Makefile->AddDefinition(resultVarName,
- readit?fullFilePath.c_str():"NOTFOUND");
+ readit?fname_abs.c_str():"NOTFOUND");
}
if(!optional && !readit && !cmSystemTools::GetFatalErrorOccured())
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6bce088..946a020 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -181,7 +181,7 @@ void cmLocalGenerator::ReadInputFile()
currentStart += "/CMakeLists.txt";
if(cmSystemTools::FileExists(currentStart.c_str(), true))
{
- this->Makefile->ReadListFile(currentStart.c_str());
+ this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
return;
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8938e67..153ed09 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1475,7 +1475,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
bool color)
{
// read in the target info file
- if(!this->Makefile->ReadListFile(0, tgtInfo) ||
+ if(!this->Makefile->ReadListFile(tgtInfo) ||
cmSystemTools::GetErrorOccuredFlag())
{
cmSystemTools::Error("Target DependInfo.cmake file not found");
@@ -1592,7 +1592,7 @@ cmLocalUnixMakefileGenerator3
std::string dirInfoFile = this->Makefile->GetStartOutputDirectory();
dirInfoFile += cmake::GetCMakeFilesDirectory();
dirInfoFile += "/CMakeDirectoryInformation.cmake";
- if(mf->ReadListFile(0, dirInfoFile.c_str()) &&
+ if(mf->ReadListFile(dirInfoFile.c_str()) &&
!cmSystemTools::GetErrorOccuredFlag())
{
haveDirectoryInfo = true;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 205508b..7be920d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -522,102 +522,79 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
}
}
+bool cmMakefile::ProcessBuildsystemFile(const char* listfile)
+{
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile);
+ this->cmCurrentListFile = listfile;
+ return this->ReadListFile(listfile, true,
+ this->cmStartDirectory == this->cmHomeDirectory);
+}
+
+bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
+{
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile());
+ this->cmCurrentListFile =
+ cmSystemTools::CollapseFullPath(listfile,
+ this->cmStartDirectory.c_str());
+ return this->ReadListFile(this->cmCurrentListFile.c_str(),
+ noPolicyScope);
+}
+
//----------------------------------------------------------------------------
// Parse the given CMakeLists.txt file executing all commands
//
-bool cmMakefile::ReadListFile(const char* filename_in,
- const char *external_in,
- std::string* fullPath,
- bool noPolicyScope)
+bool cmMakefile::ReadListFile(const char* listfile,
+ bool noPolicyScope,
+ bool requireProjectCommand)
{
+ std::string filenametoread =
+ cmSystemTools::CollapseFullPath(listfile,
+ this->cmStartDirectory.c_str());
+
std::string currentParentFile
- = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
+ = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
std::string currentFile
= this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE");
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in);
- this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
- const char* external = 0;
- std::string external_abs;
-
- const char* filename = filename_in;
- std::string filename_abs;
-
- if (external_in)
- {
- external_abs =
- cmSystemTools::CollapseFullPath(external_in,
- this->cmStartDirectory.c_str());
- external = external_abs.c_str();
- if (filename_in)
- {
- filename_abs =
- cmSystemTools::CollapseFullPath(filename_in,
- this->cmStartDirectory.c_str());
- filename = filename_abs.c_str();
- }
- }
+ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
+ cmSystemTools::GetFilenamePath(filenametoread).c_str());
- // keep track of the current file being read
- if (filename)
- {
- if(this->cmCurrentListFile != filename)
- {
- this->cmCurrentListFile = filename;
- }
- }
+ this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
+ this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
+ this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
- // Now read the input file
- const char *filenametoread= filename;
+ this->ListFileStack.push_back(filenametoread);
- if( external)
- {
- filenametoread= external;
- }
+ bool res = this->ReadListFileInternal(filenametoread.c_str(),
+ noPolicyScope, requireProjectCommand);
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread);
- this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(filenametoread).c_str());
+ cmSystemTools::GetFilenamePath(currentFile).c_str());
+ this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
+ this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
- // try to see if the list file is the top most
- // list file for a project, and if it is, then it
- // must have a project command. If there is not
- // one, then cmake will provide one via the
- // cmListFileCache class.
- bool requireProjectCommand = false;
- if(!external && this->cmStartDirectory == this->cmHomeDirectory)
- {
- if(cmSystemTools::LowerCase(
- cmSystemTools::GetFilenameName(filename)) == "cmakelists.txt")
- {
- requireProjectCommand = true;
- }
- }
+ this->ListFileStack.pop_back();
- // push the listfile onto the stack
- this->ListFileStack.push_back(filenametoread);
- if(fullPath!=0)
+ if (res)
{
- *fullPath=filenametoread;
+ // Check for unused variables
+ this->CheckForUnusedVariables();
}
+
+ return res;
+}
+
+bool cmMakefile::ReadListFileInternal(const char* filenametoread,
+ bool noPolicyScope,
+ bool requireProjectCommand)
+{
cmListFile cacheFile;
if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) )
{
- // pop the listfile off the stack
- this->ListFileStack.pop_back();
- if(fullPath!=0)
- {
- *fullPath = "";
- }
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
- this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
- this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
- this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(currentFile).c_str());
- this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
return false;
}
// add this list file to the list of dependencies
@@ -656,20 +633,6 @@ bool cmMakefile::ReadListFile(const char* filename_in,
this->EnforceDirectoryLevelRules();
}
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
- this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
- this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
- this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(currentFile).c_str());
- this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
-
- // pop the listfile off the stack
- this->ListFileStack.pop_back();
-
- // Check for unused variables
- this->CheckForUnusedVariables();
-
return true;
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 299d550..73d6910 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -86,9 +86,12 @@ public:
* Read and parse a CMakeLists.txt file.
*/
bool ReadListFile(const char* listfile,
- const char* external= 0,
- std::string* fullPath= 0,
- bool noPolicyScope = true);
+ bool noPolicyScope = true,
+ bool requireProjectCommand = false);
+
+ bool ReadDependentFile(const char* listfile, bool noPolicyScope = true);
+
+ bool ProcessBuildsystemFile(const char* listfile);
/**
* Add a function blocker to this makefile
@@ -987,6 +990,12 @@ protected:
private:
void Initialize();
+
+
+ bool ReadListFileInternal(const char* filenametoread,
+ bool noPolicyScope,
+ bool requireProjectCommand);
+
bool ParseDefineFlag(std::string const& definition, bool remove);
bool EnforceUniqueDir(const std::string& srcPath,
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 601dc54..43b02bc 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -236,8 +236,7 @@ bool cmProjectCommand
{
std::string fullFilePath;
bool readit =
- this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
- include);
+ this->Makefile->ReadDependentFile(include);
if(!readit && !cmSystemTools::GetFatalErrorOccured())
{
std::string m =
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index d49e997..3d5103f 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1243,7 +1243,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutogenInfo.cmake";
- if (!makefile->ReadListFile(0, filename.c_str()))
+ if (!makefile->ReadListFile(filename.c_str()))
{
cmSystemTools::Error("Error processing file: ", filename.c_str());
return false;
@@ -1413,7 +1413,7 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutomocOldMocDefinitions.cmake";
- if (makefile->ReadListFile(0, filename.c_str()))
+ if (makefile->ReadListFile(filename.c_str()))
{
this->OldCompileSettingsStr =
makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS");
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e624a83..d113c9f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -389,7 +389,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
lg->GetMakefile()->SetArgcArgv(args);
}
- if (!lg->GetMakefile()->ReadListFile(0, path))
+ if (!lg->GetMakefile()->ReadListFile(path))
{
cmSystemTools::Error("Error processing file: ", path);
}
@@ -425,7 +425,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
mf->SetArgcArgv(args);
std::string systemFile = mf->GetModulesFile("CMakeFindPackageMode.cmake");
- mf->ReadListFile(0, systemFile.c_str());
+ mf->ReadListFile(systemFile.c_str());
std::string language = mf->GetSafeDefinition("LANGUAGE");
std::string mode = mf->GetSafeDefinition("MODE");
@@ -1968,7 +1968,7 @@ int cmake::CheckBuildSystem()
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmMakefile* mf = lg->GetMakefile();
- if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) ||
+ if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
if(verbose)