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());
|
tempInstallDirectory.c_str());
|
||||||
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
|
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
|
||||||
tempInstallDirectory.c_str());
|
tempInstallDirectory.c_str());
|
||||||
int res = this->MakefileMap->ReadListFile(0, installScript.c_str());
|
int res = this->MakefileMap->ReadListFile(installScript.c_str());
|
||||||
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
|
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -888,7 +888,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
|||||||
"1");
|
"1");
|
||||||
}
|
}
|
||||||
// do installation
|
// do installation
|
||||||
int res = mf->ReadListFile(0, installFile.c_str());
|
int res = mf->ReadListFile(installFile.c_str());
|
||||||
// forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
|
// forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
|
||||||
// to CPack (may be used by generators like CPack RPM or DEB)
|
// to CPack (may be used by generators like CPack RPM or DEB)
|
||||||
// in order to transparently handle ABSOLUTE PATH
|
// in order to transparently handle ABSOLUTE PATH
|
||||||
@ -980,7 +980,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName)
|
|||||||
{
|
{
|
||||||
bool retval;
|
bool retval;
|
||||||
std::string fullPath = this->MakefileMap->GetModulesFile(moduleName);
|
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
|
// include FATAL_ERROR and ERROR in the return status
|
||||||
retval = retval && (! cmSystemTools::GetErrorOccuredFlag());
|
retval = retval && (! cmSystemTools::GetErrorOccuredFlag());
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -244,7 +244,7 @@ int main (int argc, char const* const* argv)
|
|||||||
// paths, so FIND_XXX() commands can be used in scripts
|
// paths, so FIND_XXX() commands can be used in scripts
|
||||||
std::string systemFile =
|
std::string systemFile =
|
||||||
globalMF->GetModulesFile("CMakeDetermineSystem.cmake");
|
globalMF->GetModulesFile("CMakeDetermineSystem.cmake");
|
||||||
if (!globalMF->ReadListFile(0, systemFile.c_str()))
|
if (!globalMF->ReadListFile(systemFile.c_str()))
|
||||||
{
|
{
|
||||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
||||||
"Error reading CMakeDetermineSystem.cmake" << std::endl);
|
"Error reading CMakeDetermineSystem.cmake" << std::endl);
|
||||||
@ -253,7 +253,7 @@ int main (int argc, char const* const* argv)
|
|||||||
|
|
||||||
systemFile =
|
systemFile =
|
||||||
globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake");
|
globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake");
|
||||||
if (!globalMF->ReadListFile(0, systemFile.c_str()))
|
if (!globalMF->ReadListFile(systemFile.c_str()))
|
||||||
{
|
{
|
||||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
||||||
"Error reading CMakeSystemSpecificInformation.cmake" << std::endl);
|
"Error reading CMakeSystemSpecificInformation.cmake" << std::endl);
|
||||||
@ -272,7 +272,7 @@ int main (int argc, char const* const* argv)
|
|||||||
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
|
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
|
||||||
"Read CPack configuration file: " << cpackConfigFile
|
"Read CPack configuration file: " << cpackConfigFile
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
if ( !globalMF->ReadListFile(0, cpackConfigFile.c_str()) )
|
if ( !globalMF->ReadListFile(cpackConfigFile.c_str()) )
|
||||||
{
|
{
|
||||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
||||||
"Problem reading CPack config file: \""
|
"Problem reading CPack config file: \""
|
||||||
|
@ -757,7 +757,7 @@ void cmCTestLaunch::LoadConfig()
|
|||||||
std::string fname = this->LogDir;
|
std::string fname = this->LogDir;
|
||||||
fname += "CTestLaunchConfig.cmake";
|
fname += "CTestLaunchConfig.cmake";
|
||||||
if(cmSystemTools::FileExists(fname.c_str()) &&
|
if(cmSystemTools::FileExists(fname.c_str()) &&
|
||||||
mf->ReadListFile(0, fname.c_str()))
|
mf->ReadListFile(fname.c_str()))
|
||||||
{
|
{
|
||||||
this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
|
this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
|
||||||
cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
|
cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
|
||||||
|
@ -433,7 +433,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
|
|||||||
ctest scripting easier. */
|
ctest scripting easier. */
|
||||||
std::string systemFile =
|
std::string systemFile =
|
||||||
this->Makefile->GetModulesFile("CTestScriptMode.cmake");
|
this->Makefile->GetModulesFile("CTestScriptMode.cmake");
|
||||||
if (!this->Makefile->ReadListFile(0, systemFile.c_str()) ||
|
if (!this->Makefile->ReadListFile(systemFile.c_str()) ||
|
||||||
cmSystemTools::GetErrorOccuredFlag())
|
cmSystemTools::GetErrorOccuredFlag())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:"
|
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
|
// finally read in the script
|
||||||
if (!this->Makefile->ReadListFile(0, script.c_str()) ||
|
if (!this->Makefile->ReadListFile(script.c_str()) ||
|
||||||
cmSystemTools::GetErrorOccuredFlag())
|
cmSystemTools::GetErrorOccuredFlag())
|
||||||
{
|
{
|
||||||
// Reset the error flag so that it can run more than
|
// Reset the error flag so that it can run more than
|
||||||
|
@ -117,9 +117,7 @@ bool cmCTestSubdirCommand
|
|||||||
}
|
}
|
||||||
fname += "/";
|
fname += "/";
|
||||||
fname += testFilename;
|
fname += testFilename;
|
||||||
bool readit =
|
bool readit = this->Makefile->ReadDependentFile(fname.c_str());
|
||||||
this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
|
|
||||||
fname.c_str());
|
|
||||||
cmSystemTools::ChangeDirectory(cwd);
|
cmSystemTools::ChangeDirectory(cwd);
|
||||||
if(!readit)
|
if(!readit)
|
||||||
{
|
{
|
||||||
@ -205,9 +203,7 @@ bool cmCTestAddSubdirectoryCommand
|
|||||||
}
|
}
|
||||||
fname += "/";
|
fname += "/";
|
||||||
fname += testFilename;
|
fname += testFilename;
|
||||||
bool readit =
|
bool readit = this->Makefile->ReadDependentFile(fname.c_str());
|
||||||
this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
|
|
||||||
fname.c_str());
|
|
||||||
cmSystemTools::ChangeDirectory(cwd);
|
cmSystemTools::ChangeDirectory(cwd);
|
||||||
if(!readit)
|
if(!readit)
|
||||||
{
|
{
|
||||||
@ -1621,7 +1617,7 @@ void cmCTestTestHandler::GetListOfTests()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !mf->ReadListFile(0, testFilename) )
|
if ( !mf->ReadListFile(testFilename) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -687,8 +687,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
|
|||||||
{
|
{
|
||||||
cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: "
|
cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: "
|
||||||
<< fname << std::endl, command->ShouldBeQuiet());
|
<< fname << std::endl, command->ShouldBeQuiet());
|
||||||
bool readit = mf->ReadListFile(mf->GetCurrentListFile(),
|
bool readit = mf->ReadDependentFile(fname.c_str());
|
||||||
fname.c_str() );
|
|
||||||
if(!readit)
|
if(!readit)
|
||||||
{
|
{
|
||||||
std::string m = "Could not find include file: ";
|
std::string m = "Could not find include file: ";
|
||||||
@ -2577,7 +2576,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
|
|||||||
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
|
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
|
||||||
cmSystemTools::ResetErrorOccuredFlag();
|
cmSystemTools::ResetErrorOccuredFlag();
|
||||||
|
|
||||||
if ( !mf->ReadListFile(0, fname.c_str()) ||
|
if ( !mf->ReadListFile(fname.c_str()) ||
|
||||||
cmSystemTools::GetErrorOccuredFlag() )
|
cmSystemTools::GetErrorOccuredFlag() )
|
||||||
{
|
{
|
||||||
cmCTestLog(this, ERROR_MESSAGE,
|
cmCTestLog(this, ERROR_MESSAGE,
|
||||||
@ -2607,7 +2606,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
|
|||||||
{
|
{
|
||||||
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
|
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
|
||||||
<< *fileIt << std::endl);
|
<< *fileIt << std::endl);
|
||||||
if ( !mf->ReadListFile(0, fileIt->c_str()) ||
|
if ( !mf->ReadListFile(fileIt->c_str()) ||
|
||||||
cmSystemTools::GetErrorOccuredFlag() )
|
cmSystemTools::GetErrorOccuredFlag() )
|
||||||
{
|
{
|
||||||
cmCTestLog(this, ERROR_MESSAGE,
|
cmCTestLog(this, ERROR_MESSAGE,
|
||||||
|
@ -999,8 +999,8 @@ bool cmFindPackageCommand::FindAppBundleConfig()
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
|
bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
|
||||||
{
|
{
|
||||||
if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), f, 0,
|
const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
|
||||||
!this->PolicyScope || psr == NoPolicyScope))
|
if(this->Makefile->ReadDependentFile(f, noPolicyScope))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
|
|||||||
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
|
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
|
||||||
if(!setMakeProgram.empty())
|
if(!setMakeProgram.empty())
|
||||||
{
|
{
|
||||||
mf->ReadListFile(0, setMakeProgram.c_str());
|
mf->ReadListFile(setMakeProgram.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|
||||||
@ -428,7 +428,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
fpath += "/CMakeSystem.cmake";
|
fpath += "/CMakeSystem.cmake";
|
||||||
if(cmSystemTools::FileExists(fpath.c_str()))
|
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
|
// Load the CMakeDetermineSystem.cmake file and find out
|
||||||
@ -456,12 +456,12 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
#endif
|
#endif
|
||||||
// Read the DetermineSystem file
|
// Read the DetermineSystem file
|
||||||
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
|
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
|
// load the CMakeSystem.cmake from the binary directory
|
||||||
// this file is configured by the CMakeDetermineSystem.cmake file
|
// this file is configured by the CMakeDetermineSystem.cmake file
|
||||||
fpath = rootBin;
|
fpath = rootBin;
|
||||||
fpath += "/CMakeSystem.cmake";
|
fpath += "/CMakeSystem.cmake";
|
||||||
mf->ReadListFile(0,fpath.c_str());
|
mf->ReadListFile(fpath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(readCMakeSystem)
|
if(readCMakeSystem)
|
||||||
@ -495,7 +495,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED"))
|
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED"))
|
||||||
{
|
{
|
||||||
fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake");
|
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: "
|
cmSystemTools::Error("Could not find cmake module file: "
|
||||||
"CMakeSystemSpecificInitialize.cmake");
|
"CMakeSystemSpecificInitialize.cmake");
|
||||||
@ -533,7 +533,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
// to avoid duplicate compiler tests.
|
// to avoid duplicate compiler tests.
|
||||||
if(cmSystemTools::FileExists(fpath.c_str()))
|
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: ",
|
cmSystemTools::Error("Could not find cmake module file: ",
|
||||||
fpath.c_str());
|
fpath.c_str());
|
||||||
@ -563,7 +563,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
determineCompiler += "Compiler.cmake";
|
determineCompiler += "Compiler.cmake";
|
||||||
std::string determineFile =
|
std::string determineFile =
|
||||||
mf->GetModulesFile(determineCompiler.c_str());
|
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: ",
|
cmSystemTools::Error("Could not find cmake module file: ",
|
||||||
determineCompiler.c_str());
|
determineCompiler.c_str());
|
||||||
@ -597,7 +597,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
fpath += "/CMake";
|
fpath += "/CMake";
|
||||||
fpath += lang;
|
fpath += lang;
|
||||||
fpath += "Compiler.cmake";
|
fpath += "Compiler.cmake";
|
||||||
if(!mf->ReadListFile(0,fpath.c_str()))
|
if(!mf->ReadListFile(fpath.c_str()))
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Could not find cmake module file: ",
|
cmSystemTools::Error("Could not find cmake module file: ",
|
||||||
fpath.c_str());
|
fpath.c_str());
|
||||||
@ -616,7 +616,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
|
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
|
||||||
{
|
{
|
||||||
fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake");
|
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: "
|
cmSystemTools::Error("Could not find cmake module file: "
|
||||||
"CMakeSystemSpecificInformation.cmake");
|
"CMakeSystemSpecificInformation.cmake");
|
||||||
@ -707,7 +707,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
cmSystemTools::Error("Could not find cmake module file: ",
|
cmSystemTools::Error("Could not find cmake module file: ",
|
||||||
fpath.c_str());
|
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: ",
|
cmSystemTools::Error("Could not process cmake module file: ",
|
||||||
informationFile.c_str());
|
informationFile.c_str());
|
||||||
@ -732,7 +732,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
testLang += lang;
|
testLang += lang;
|
||||||
testLang += "Compiler.cmake";
|
testLang += "Compiler.cmake";
|
||||||
std::string ifpath = mf->GetModulesFile(testLang.c_str());
|
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: ",
|
cmSystemTools::Error("Could not find cmake module file: ",
|
||||||
testLang.c_str());
|
testLang.c_str());
|
||||||
@ -777,7 +777,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||||||
projectCompatibility += "Compatibility.cmake";
|
projectCompatibility += "Compatibility.cmake";
|
||||||
if(cmSystemTools::FileExists(projectCompatibility.c_str()))
|
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.
|
// Inform any extra generator of the new language.
|
||||||
if (this->ExtraGenerator)
|
if (this->ExtraGenerator)
|
||||||
|
@ -60,7 +60,7 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
|
|||||||
fname += "/Templates";
|
fname += "/Templates";
|
||||||
}
|
}
|
||||||
fname += "/CMakeVisualStudio6Configurations.cmake";
|
fname += "/CMakeVisualStudio6Configurations.cmake";
|
||||||
if(!mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str()))
|
if(!mf->ReadDependentFile(fname.c_str()))
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Cannot open ", fname.c_str(),
|
cmSystemTools::Error("Cannot open ", fname.c_str(),
|
||||||
". Please copy this file from the main "
|
". 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: ",
|
cmSystemTools::Error("Problem opening GraphViz options file: ",
|
||||||
inFileName);
|
inFileName);
|
||||||
|
@ -130,17 +130,14 @@ bool cmIncludeCommand
|
|||||||
gg->GenerateImportFile(fname_abs);
|
gg->GenerateImportFile(fname_abs);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fullFilePath;
|
|
||||||
bool readit =
|
bool readit =
|
||||||
this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
|
this->Makefile->ReadDependentFile(fname.c_str(), noPolicyScope);
|
||||||
fname.c_str(), &fullFilePath,
|
|
||||||
noPolicyScope);
|
|
||||||
|
|
||||||
// add the location of the included file if a result variable was given
|
// add the location of the included file if a result variable was given
|
||||||
if (!resultVarName.empty())
|
if (!resultVarName.empty())
|
||||||
{
|
{
|
||||||
this->Makefile->AddDefinition(resultVarName,
|
this->Makefile->AddDefinition(resultVarName,
|
||||||
readit?fullFilePath.c_str():"NOTFOUND");
|
readit?fname_abs.c_str():"NOTFOUND");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!optional && !readit && !cmSystemTools::GetFatalErrorOccured())
|
if(!optional && !readit && !cmSystemTools::GetFatalErrorOccured())
|
||||||
|
@ -181,7 +181,7 @@ void cmLocalGenerator::ReadInputFile()
|
|||||||
currentStart += "/CMakeLists.txt";
|
currentStart += "/CMakeLists.txt";
|
||||||
if(cmSystemTools::FileExists(currentStart.c_str(), true))
|
if(cmSystemTools::FileExists(currentStart.c_str(), true))
|
||||||
{
|
{
|
||||||
this->Makefile->ReadListFile(currentStart.c_str());
|
this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1475,7 +1475,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
|
|||||||
bool color)
|
bool color)
|
||||||
{
|
{
|
||||||
// read in the target info file
|
// read in the target info file
|
||||||
if(!this->Makefile->ReadListFile(0, tgtInfo) ||
|
if(!this->Makefile->ReadListFile(tgtInfo) ||
|
||||||
cmSystemTools::GetErrorOccuredFlag())
|
cmSystemTools::GetErrorOccuredFlag())
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Target DependInfo.cmake file not found");
|
cmSystemTools::Error("Target DependInfo.cmake file not found");
|
||||||
@ -1592,7 +1592,7 @@ cmLocalUnixMakefileGenerator3
|
|||||||
std::string dirInfoFile = this->Makefile->GetStartOutputDirectory();
|
std::string dirInfoFile = this->Makefile->GetStartOutputDirectory();
|
||||||
dirInfoFile += cmake::GetCMakeFilesDirectory();
|
dirInfoFile += cmake::GetCMakeFilesDirectory();
|
||||||
dirInfoFile += "/CMakeDirectoryInformation.cmake";
|
dirInfoFile += "/CMakeDirectoryInformation.cmake";
|
||||||
if(mf->ReadListFile(0, dirInfoFile.c_str()) &&
|
if(mf->ReadListFile(dirInfoFile.c_str()) &&
|
||||||
!cmSystemTools::GetErrorOccuredFlag())
|
!cmSystemTools::GetErrorOccuredFlag())
|
||||||
{
|
{
|
||||||
haveDirectoryInfo = true;
|
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
|
// Parse the given CMakeLists.txt file executing all commands
|
||||||
//
|
//
|
||||||
bool cmMakefile::ReadListFile(const char* filename_in,
|
bool cmMakefile::ReadListFile(const char* listfile,
|
||||||
const char *external_in,
|
bool noPolicyScope,
|
||||||
std::string* fullPath,
|
bool requireProjectCommand)
|
||||||
bool noPolicyScope)
|
|
||||||
{
|
{
|
||||||
|
std::string filenametoread =
|
||||||
|
cmSystemTools::CollapseFullPath(listfile,
|
||||||
|
this->cmStartDirectory.c_str());
|
||||||
|
|
||||||
std::string currentParentFile
|
std::string currentParentFile
|
||||||
= this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
|
= this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
|
||||||
std::string currentFile
|
std::string currentFile
|
||||||
= this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE");
|
= this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE");
|
||||||
this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in);
|
|
||||||
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
|
|
||||||
|
|
||||||
const char* external = 0;
|
this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread.c_str());
|
||||||
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_DIR",
|
this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
|
||||||
cmSystemTools::GetFilenamePath(filenametoread).c_str());
|
cmSystemTools::GetFilenamePath(filenametoread).c_str());
|
||||||
|
|
||||||
|
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
|
||||||
|
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
|
||||||
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
|
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
|
||||||
|
|
||||||
// try to see if the list file is the top most
|
this->ListFileStack.push_back(filenametoread);
|
||||||
// list file for a project, and if it is, then it
|
|
||||||
// must have a project command. If there is not
|
bool res = this->ReadListFileInternal(filenametoread.c_str(),
|
||||||
// one, then cmake will provide one via the
|
noPolicyScope, requireProjectCommand);
|
||||||
// cmListFileCache class.
|
|
||||||
bool requireProjectCommand = false;
|
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
|
||||||
if(!external && this->cmStartDirectory == this->cmHomeDirectory)
|
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(
|
// Check for unused variables
|
||||||
cmSystemTools::GetFilenameName(filename)) == "cmakelists.txt")
|
this->CheckForUnusedVariables();
|
||||||
{
|
|
||||||
requireProjectCommand = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// push the listfile onto the stack
|
return res;
|
||||||
this->ListFileStack.push_back(filenametoread);
|
}
|
||||||
if(fullPath!=0)
|
|
||||||
{
|
bool cmMakefile::ReadListFileInternal(const char* filenametoread,
|
||||||
*fullPath=filenametoread;
|
bool noPolicyScope,
|
||||||
}
|
bool requireProjectCommand)
|
||||||
|
{
|
||||||
cmListFile cacheFile;
|
cmListFile cacheFile;
|
||||||
if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
// add this list file to the list of dependencies
|
// add this list file to the list of dependencies
|
||||||
@ -656,20 +633,6 @@ bool cmMakefile::ReadListFile(const char* filename_in,
|
|||||||
this->EnforceDirectoryLevelRules();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,9 +86,12 @@ public:
|
|||||||
* Read and parse a CMakeLists.txt file.
|
* Read and parse a CMakeLists.txt file.
|
||||||
*/
|
*/
|
||||||
bool ReadListFile(const char* listfile,
|
bool ReadListFile(const char* listfile,
|
||||||
const char* external= 0,
|
bool noPolicyScope = true,
|
||||||
std::string* fullPath= 0,
|
bool requireProjectCommand = false);
|
||||||
bool noPolicyScope = true);
|
|
||||||
|
bool ReadDependentFile(const char* listfile, bool noPolicyScope = true);
|
||||||
|
|
||||||
|
bool ProcessBuildsystemFile(const char* listfile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a function blocker to this makefile
|
* Add a function blocker to this makefile
|
||||||
@ -987,6 +990,12 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool ReadListFileInternal(const char* filenametoread,
|
||||||
|
bool noPolicyScope,
|
||||||
|
bool requireProjectCommand);
|
||||||
|
|
||||||
bool ParseDefineFlag(std::string const& definition, bool remove);
|
bool ParseDefineFlag(std::string const& definition, bool remove);
|
||||||
|
|
||||||
bool EnforceUniqueDir(const std::string& srcPath,
|
bool EnforceUniqueDir(const std::string& srcPath,
|
||||||
|
@ -236,8 +236,7 @@ bool cmProjectCommand
|
|||||||
{
|
{
|
||||||
std::string fullFilePath;
|
std::string fullFilePath;
|
||||||
bool readit =
|
bool readit =
|
||||||
this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
|
this->Makefile->ReadDependentFile(include);
|
||||||
include);
|
|
||||||
if(!readit && !cmSystemTools::GetFatalErrorOccured())
|
if(!readit && !cmSystemTools::GetFatalErrorOccured())
|
||||||
{
|
{
|
||||||
std::string m =
|
std::string m =
|
||||||
|
@ -1243,7 +1243,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
|
|||||||
cmSystemTools::ConvertToUnixSlashes(filename);
|
cmSystemTools::ConvertToUnixSlashes(filename);
|
||||||
filename += "/AutogenInfo.cmake";
|
filename += "/AutogenInfo.cmake";
|
||||||
|
|
||||||
if (!makefile->ReadListFile(0, filename.c_str()))
|
if (!makefile->ReadListFile(filename.c_str()))
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Error processing file: ", filename.c_str());
|
cmSystemTools::Error("Error processing file: ", filename.c_str());
|
||||||
return false;
|
return false;
|
||||||
@ -1413,7 +1413,7 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
|
|||||||
cmSystemTools::ConvertToUnixSlashes(filename);
|
cmSystemTools::ConvertToUnixSlashes(filename);
|
||||||
filename += "/AutomocOldMocDefinitions.cmake";
|
filename += "/AutomocOldMocDefinitions.cmake";
|
||||||
|
|
||||||
if (makefile->ReadListFile(0, filename.c_str()))
|
if (makefile->ReadListFile(filename.c_str()))
|
||||||
{
|
{
|
||||||
this->OldCompileSettingsStr =
|
this->OldCompileSettingsStr =
|
||||||
makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS");
|
makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS");
|
||||||
|
@ -389,7 +389,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
|
|||||||
|
|
||||||
lg->GetMakefile()->SetArgcArgv(args);
|
lg->GetMakefile()->SetArgcArgv(args);
|
||||||
}
|
}
|
||||||
if (!lg->GetMakefile()->ReadListFile(0, path))
|
if (!lg->GetMakefile()->ReadListFile(path))
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Error processing file: ", path);
|
cmSystemTools::Error("Error processing file: ", path);
|
||||||
}
|
}
|
||||||
@ -425,7 +425,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
|
|||||||
mf->SetArgcArgv(args);
|
mf->SetArgcArgv(args);
|
||||||
|
|
||||||
std::string systemFile = mf->GetModulesFile("CMakeFindPackageMode.cmake");
|
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 language = mf->GetSafeDefinition("LANGUAGE");
|
||||||
std::string mode = mf->GetSafeDefinition("MODE");
|
std::string mode = mf->GetSafeDefinition("MODE");
|
||||||
@ -1968,7 +1968,7 @@ int cmake::CheckBuildSystem()
|
|||||||
gg.SetCMakeInstance(&cm);
|
gg.SetCMakeInstance(&cm);
|
||||||
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
|
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
|
||||||
cmMakefile* mf = lg->GetMakefile();
|
cmMakefile* mf = lg->GetMakefile();
|
||||||
if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) ||
|
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
|
||||||
cmSystemTools::GetErrorOccuredFlag())
|
cmSystemTools::GetErrorOccuredFlag())
|
||||||
{
|
{
|
||||||
if(verbose)
|
if(verbose)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user