Merge topic 'clean-up-ReadListFile'
05245b42 cmMakefile: Move some preamble out of the Internal method. 6e23a4bd cmMakefile: Remove always-null first parameter to ReadListFile. d21ebcb2 cmMakefile: Swap parameters of calls to ReadListFile. 95a27267 cmMakefile: Extract conditional code to caller. 7d248547 cmMakefile: Remove intermediate variable. 9db15954 cmMakefile: Move condition to the only calling context where it is true. 5d4480a8 cmMakefile: Populate CMAKE_PARENT_LIST_FILE in callers. 3a8ac242 cmMakefile: Collapse nested conditional. 5947d9b0 cmMakefile: Convert filenametoread into a std::string. e2d0e0fb cmMakefile: Remove intermediate variable. 3a1ad171 cmMakefile: Combine duplicate condition. f0dae032 cmMakefile: Re-order independent statements. 08da8742 cmMakefile: Split a conditional. 3dc4fe02 cmMakefile: Re-order independent variable setting. e4f8f1f1 cmMakefile: Remove intermediate variable. 2d6121a9 cmMakefile: Remove use of intermediate variable. ...
This commit is contained in:
commit
f438cd3731
@ -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;
|
||||
|
@ -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: \""
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 "
|
||||
|
@ -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);
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
// keep track of the current file being read
|
||||
if (filename)
|
||||
{
|
||||
if(this->cmCurrentListFile != filename)
|
||||
{
|
||||
this->cmCurrentListFile = filename;
|
||||
}
|
||||
}
|
||||
|
||||
// Now read the input file
|
||||
const char *filenametoread= filename;
|
||||
|
||||
if( external)
|
||||
{
|
||||
filenametoread= external;
|
||||
}
|
||||
|
||||
this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread);
|
||||
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
|
||||
this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread.c_str());
|
||||
this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
|
||||
cmSystemTools::GetFilenamePath(filenametoread).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)
|
||||
this->ListFileStack.push_back(filenametoread);
|
||||
|
||||
bool res = this->ReadListFileInternal(filenametoread.c_str(),
|
||||
noPolicyScope, requireProjectCommand);
|
||||
|
||||
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(currentFile).c_str());
|
||||
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
|
||||
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
|
||||
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
|
||||
|
||||
this->ListFileStack.pop_back();
|
||||
|
||||
if (res)
|
||||
{
|
||||
if(cmSystemTools::LowerCase(
|
||||
cmSystemTools::GetFilenameName(filename)) == "cmakelists.txt")
|
||||
{
|
||||
requireProjectCommand = true;
|
||||
}
|
||||
// Check for unused variables
|
||||
this->CheckForUnusedVariables();
|
||||
}
|
||||
|
||||
// push the listfile onto the stack
|
||||
this->ListFileStack.push_back(filenametoread);
|
||||
if(fullPath!=0)
|
||||
{
|
||||
*fullPath=filenametoread;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 =
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user