mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 22:10:32 +00:00
cmMakefile::ReadListFile() accepts std::string argument
Same for cmMakefile::ReadDependentFile(); some cleanup
This commit is contained in:
parent
68e20f674a
commit
25caf7bafe
@ -68,7 +68,7 @@ int cmCPackExternalGenerator::PackageFiles()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = this->MakefileMap->ReadListFile(packageScript);
|
||||
bool res = this->MakefileMap->ReadListFile(packageScript);
|
||||
|
||||
if (cmSystemTools::GetErrorOccuredFlag() || !res) {
|
||||
return 0;
|
||||
|
@ -498,7 +498,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
|
||||
tempInstallDirectory.c_str());
|
||||
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
|
||||
tempInstallDirectory.c_str());
|
||||
int res = this->MakefileMap->ReadListFile(installScript.c_str());
|
||||
bool res = this->MakefileMap->ReadListFile(installScript);
|
||||
if (cmSystemTools::GetErrorOccuredFlag() || !res) {
|
||||
return 0;
|
||||
}
|
||||
@ -851,7 +851,7 @@ int cmCPackGenerator::InstallCMakeProject(
|
||||
mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
|
||||
}
|
||||
// do installation
|
||||
int res = mf.ReadListFile(installFile.c_str());
|
||||
bool res = mf.ReadListFile(installFile);
|
||||
// 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
|
||||
@ -927,7 +927,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName)
|
||||
{
|
||||
bool retval;
|
||||
std::string fullPath = this->MakefileMap->GetModulesFile(moduleName);
|
||||
retval = this->MakefileMap->ReadListFile(fullPath.c_str());
|
||||
retval = this->MakefileMap->ReadListFile(fullPath);
|
||||
// include FATAL_ERROR and ERROR in the return status
|
||||
retval = retval && (!cmSystemTools::GetErrorOccuredFlag());
|
||||
return retval;
|
||||
|
@ -256,7 +256,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(systemFile.c_str())) {
|
||||
if (!globalMF.ReadListFile(systemFile)) {
|
||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
||||
"Error reading CMakeDetermineSystem.cmake" << std::endl);
|
||||
return 1;
|
||||
@ -264,7 +264,7 @@ int main(int argc, char const* const* argv)
|
||||
|
||||
systemFile =
|
||||
globalMF.GetModulesFile("CMakeSystemSpecificInformation.cmake");
|
||||
if (!globalMF.ReadListFile(systemFile.c_str())) {
|
||||
if (!globalMF.ReadListFile(systemFile)) {
|
||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
||||
"Error reading CMakeSystemSpecificInformation.cmake"
|
||||
<< std::endl);
|
||||
@ -280,7 +280,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(cpackConfigFile.c_str())) {
|
||||
if (!globalMF.ReadListFile(cpackConfigFile)) {
|
||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
||||
"Problem reading CPack config file: \""
|
||||
<< cpackConfigFile << "\"" << std::endl);
|
||||
|
@ -619,7 +619,7 @@ void cmCTestLaunch::LoadConfig()
|
||||
cmMakefile mf(&gg, cm.GetCurrentSnapshot());
|
||||
std::string fname = this->LogDir;
|
||||
fname += "CTestLaunchConfig.cmake";
|
||||
if (cmSystemTools::FileExists(fname) && mf.ReadListFile(fname.c_str())) {
|
||||
if (cmSystemTools::FileExists(fname) && mf.ReadListFile(fname)) {
|
||||
this->SourceDir = mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
|
||||
cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
|
||||
}
|
||||
|
@ -373,7 +373,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(systemFile.c_str()) ||
|
||||
if (!this->Makefile->ReadListFile(systemFile) ||
|
||||
cmSystemTools::GetErrorOccuredFlag()) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
"Error in read:" << systemFile << "\n");
|
||||
@ -388,7 +388,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
|
||||
}
|
||||
|
||||
// finally read in the script
|
||||
if (!this->Makefile->ReadListFile(script.c_str()) ||
|
||||
if (!this->Makefile->ReadListFile(script) ||
|
||||
cmSystemTools::GetErrorOccuredFlag()) {
|
||||
// Reset the error flag so that it can run more than
|
||||
// one script with an error when you use ctest_run_script.
|
||||
|
@ -104,7 +104,7 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args,
|
||||
}
|
||||
fname += "/";
|
||||
fname += testFilename;
|
||||
readit = this->Makefile->ReadDependentFile(fname.c_str());
|
||||
readit = this->Makefile->ReadDependentFile(fname);
|
||||
}
|
||||
if (!readit) {
|
||||
std::string m = "Could not find include file: ";
|
||||
@ -170,7 +170,7 @@ bool cmCTestAddSubdirectoryCommand::InitialPass(
|
||||
}
|
||||
fname += "/";
|
||||
fname += testFilename;
|
||||
readit = this->Makefile->ReadDependentFile(fname.c_str());
|
||||
readit = this->Makefile->ReadDependentFile(fname);
|
||||
}
|
||||
if (!readit) {
|
||||
std::string m = "Could not find include file: ";
|
||||
|
@ -640,7 +640,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
|
||||
" Reading ctest configuration file: " << fname
|
||||
<< std::endl,
|
||||
command->ShouldBeQuiet());
|
||||
bool readit = mf->ReadDependentFile(fname.c_str());
|
||||
bool readit = mf->ReadDependentFile(fname);
|
||||
if (!readit) {
|
||||
std::string m = "Could not find include file: ";
|
||||
m += fname;
|
||||
@ -2469,8 +2469,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
|
||||
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
|
||||
cmSystemTools::ResetErrorOccuredFlag();
|
||||
|
||||
if (!mf->ReadListFile(fname.c_str()) ||
|
||||
cmSystemTools::GetErrorOccuredFlag()) {
|
||||
if (!mf->ReadListFile(fname) || cmSystemTools::GetErrorOccuredFlag()) {
|
||||
cmCTestLog(this, ERROR_MESSAGE,
|
||||
"Problem reading custom configuration: " << fname
|
||||
<< std::endl);
|
||||
@ -2489,15 +2488,13 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
|
||||
gl.RecurseOn();
|
||||
gl.FindFiles(rexpr);
|
||||
std::vector<std::string>& files = gl.GetFiles();
|
||||
std::vector<std::string>::iterator fileIt;
|
||||
for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
|
||||
for (const std::string& file : files) {
|
||||
cmCTestLog(this, DEBUG,
|
||||
"* Read custom CTest configuration file: " << *fileIt
|
||||
"* Read custom CTest configuration file: " << file
|
||||
<< std::endl);
|
||||
if (!mf->ReadListFile(fileIt->c_str()) ||
|
||||
cmSystemTools::GetErrorOccuredFlag()) {
|
||||
if (!mf->ReadListFile(file) || cmSystemTools::GetErrorOccuredFlag()) {
|
||||
cmCTestLog(this, ERROR_MESSAGE,
|
||||
"Problem reading custom configuration: " << *fileIt
|
||||
"Problem reading custom configuration: " << file
|
||||
<< std::endl);
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
|
||||
std::string setMakeProgram =
|
||||
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
|
||||
if (!setMakeProgram.empty()) {
|
||||
mf->ReadListFile(setMakeProgram.c_str());
|
||||
mf->ReadListFile(setMakeProgram);
|
||||
}
|
||||
}
|
||||
if (!mf->GetDefinition("CMAKE_MAKE_PROGRAM") ||
|
||||
@ -522,7 +522,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
if (readCMakeSystem) {
|
||||
fpath += "/CMakeSystem.cmake";
|
||||
if (cmSystemTools::FileExists(fpath)) {
|
||||
mf->ReadListFile(fpath.c_str());
|
||||
mf->ReadListFile(fpath);
|
||||
}
|
||||
}
|
||||
// Load the CMakeDetermineSystem.cmake file and find out
|
||||
@ -551,12 +551,12 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
#endif
|
||||
// Read the DetermineSystem file
|
||||
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
|
||||
mf->ReadListFile(systemFile.c_str());
|
||||
mf->ReadListFile(systemFile);
|
||||
// load the CMakeSystem.cmake from the binary directory
|
||||
// this file is configured by the CMakeDetermineSystem.cmake file
|
||||
fpath = rootBin;
|
||||
fpath += "/CMakeSystem.cmake";
|
||||
mf->ReadListFile(fpath.c_str());
|
||||
mf->ReadListFile(fpath);
|
||||
}
|
||||
|
||||
if (readCMakeSystem) {
|
||||
@ -603,7 +603,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
// **** Load the system specific initialization if not yet loaded
|
||||
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) {
|
||||
fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake");
|
||||
if (!mf->ReadListFile(fpath.c_str())) {
|
||||
if (!mf->ReadListFile(fpath)) {
|
||||
cmSystemTools::Error("Could not find cmake module file: "
|
||||
"CMakeSystemSpecificInitialize.cmake");
|
||||
}
|
||||
@ -635,7 +635,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
// version of CMake then try to load the configured file first
|
||||
// to avoid duplicate compiler tests.
|
||||
if (cmSystemTools::FileExists(fpath)) {
|
||||
if (!mf->ReadListFile(fpath.c_str())) {
|
||||
if (!mf->ReadListFile(fpath)) {
|
||||
cmSystemTools::Error("Could not find cmake module file: ",
|
||||
fpath.c_str());
|
||||
}
|
||||
@ -662,7 +662,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
determineCompiler += "Compiler.cmake";
|
||||
std::string determineFile =
|
||||
mf->GetModulesFile(determineCompiler.c_str());
|
||||
if (!mf->ReadListFile(determineFile.c_str())) {
|
||||
if (!mf->ReadListFile(determineFile)) {
|
||||
cmSystemTools::Error("Could not find cmake module file: ",
|
||||
determineCompiler.c_str());
|
||||
}
|
||||
@ -696,7 +696,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
fpath += "/CMake";
|
||||
fpath += lang;
|
||||
fpath += "Compiler.cmake";
|
||||
if (!mf->ReadListFile(fpath.c_str())) {
|
||||
if (!mf->ReadListFile(fpath)) {
|
||||
cmSystemTools::Error("Could not find cmake module file: ",
|
||||
fpath.c_str());
|
||||
}
|
||||
@ -713,7 +713,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
// **** Load the system specific information if not yet loaded
|
||||
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) {
|
||||
fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake");
|
||||
if (!mf->ReadListFile(fpath.c_str())) {
|
||||
if (!mf->ReadListFile(fpath)) {
|
||||
cmSystemTools::Error("Could not find cmake module file: "
|
||||
"CMakeSystemSpecificInformation.cmake");
|
||||
}
|
||||
@ -793,7 +793,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
if (informationFile.empty()) {
|
||||
cmSystemTools::Error("Could not find cmake module file: ",
|
||||
fpath.c_str());
|
||||
} else if (!mf->ReadListFile(informationFile.c_str())) {
|
||||
} else if (!mf->ReadListFile(informationFile)) {
|
||||
cmSystemTools::Error("Could not process cmake module file: ",
|
||||
informationFile.c_str());
|
||||
}
|
||||
@ -814,7 +814,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
testLang += lang;
|
||||
testLang += "Compiler.cmake";
|
||||
std::string ifpath = mf->GetModulesFile(testLang.c_str());
|
||||
if (!mf->ReadListFile(ifpath.c_str())) {
|
||||
if (!mf->ReadListFile(ifpath)) {
|
||||
cmSystemTools::Error("Could not find cmake module file: ",
|
||||
testLang.c_str());
|
||||
}
|
||||
@ -852,7 +852,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
projectCompatibility += mf->GetSafeDefinition("PROJECT_NAME");
|
||||
projectCompatibility += "Compatibility.cmake";
|
||||
if (cmSystemTools::FileExists(projectCompatibility)) {
|
||||
mf->ReadListFile(projectCompatibility.c_str());
|
||||
mf->ReadListFile(projectCompatibility);
|
||||
}
|
||||
// Inform any extra generator of the new language.
|
||||
if (this->ExtraGenerator) {
|
||||
|
@ -120,8 +120,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool readit =
|
||||
this->Makefile->ReadDependentFile(listFile.c_str(), noPolicyScope);
|
||||
bool readit = this->Makefile->ReadDependentFile(listFile, noPolicyScope);
|
||||
|
||||
// add the location of the included file if a result variable was given
|
||||
if (!resultVarName.empty()) {
|
||||
|
@ -1364,8 +1364,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
|
||||
std::string dirInfoFile = this->GetCurrentBinaryDirectory();
|
||||
dirInfoFile += cmake::GetCMakeFilesDirectory();
|
||||
dirInfoFile += "/CMakeDirectoryInformation.cmake";
|
||||
if (mf->ReadListFile(dirInfoFile.c_str()) &&
|
||||
!cmSystemTools::GetErrorOccuredFlag()) {
|
||||
if (mf->ReadListFile(dirInfoFile) && !cmSystemTools::GetErrorOccuredFlag()) {
|
||||
haveDirectoryInfo = true;
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
|
||||
}
|
||||
}
|
||||
|
||||
bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
|
||||
bool cmMakefile::ReadDependentFile(const std::string& filename,
|
||||
bool noPolicyScope)
|
||||
{
|
||||
this->AddDefinition("CMAKE_PARENT_LIST_FILE",
|
||||
this->GetDefinition("CMAKE_CURRENT_LIST_FILE"));
|
||||
@ -586,7 +587,7 @@ private:
|
||||
bool ReportError;
|
||||
};
|
||||
|
||||
bool cmMakefile::ReadListFile(const char* filename)
|
||||
bool cmMakefile::ReadListFile(const std::string& filename)
|
||||
{
|
||||
std::string filenametoread = cmSystemTools::CollapseFullPath(
|
||||
filename, this->GetCurrentSourceDirectory());
|
||||
|
@ -86,11 +86,10 @@ public:
|
||||
|
||||
cmDirectoryId GetDirectoryId() const;
|
||||
|
||||
bool ReadListFile(const char* filename);
|
||||
bool ReadListFile(const std::string& filename);
|
||||
|
||||
bool ReadDependentFile(const char* filename, bool noPolicyScope = true);
|
||||
|
||||
bool ProcessBuildsystemFile(const char* filename);
|
||||
bool ReadDependentFile(const std::string& filename,
|
||||
bool noPolicyScope = true);
|
||||
|
||||
/**
|
||||
* Add a function blocker to this makefile
|
||||
|
@ -1213,7 +1213,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
|
||||
};
|
||||
|
||||
// -- Read info file
|
||||
if (!makefile->ReadListFile(InfoFile().c_str())) {
|
||||
if (!makefile->ReadListFile(InfoFile())) {
|
||||
Log().ErrorFile(GeneratorT::GEN, InfoFile(), "File processing failed");
|
||||
return false;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
|
||||
};
|
||||
|
||||
// -- Read info file
|
||||
if (!makefile->ReadListFile(InfoFile().c_str())) {
|
||||
if (!makefile->ReadListFile(InfoFile())) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "File processing failed");
|
||||
return false;
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
|
||||
mf->SetArgcArgv(args);
|
||||
|
||||
std::string systemFile = mf->GetModulesFile("CMakeFindPackageMode.cmake");
|
||||
mf->ReadListFile(systemFile.c_str());
|
||||
mf->ReadListFile(systemFile);
|
||||
|
||||
std::string language = mf->GetSafeDefinition("LANGUAGE");
|
||||
std::string mode = mf->GetSafeDefinition("MODE");
|
||||
@ -2031,7 +2031,7 @@ int cmake::CheckBuildSystem()
|
||||
cm.GetCurrentSnapshot().SetDefaultDefinitions();
|
||||
cmGlobalGenerator gg(&cm);
|
||||
cmMakefile mf(&gg, cm.GetCurrentSnapshot());
|
||||
if (!mf.ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
|
||||
if (!mf.ReadListFile(this->CheckBuildSystemArgument) ||
|
||||
cmSystemTools::GetErrorOccuredFlag()) {
|
||||
if (verbose) {
|
||||
std::ostringstream msg;
|
||||
|
Loading…
Reference in New Issue
Block a user