diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-02-18 14:54:51 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-02-19 01:48:19 (GMT) |
commit | 0281f9a4cad6e189601a87c9ccfba8c54e71e14b (patch) | |
tree | 7cb6ecd89a38397e4ca191078fab91f1875eedba /Source | |
parent | bafd0ffa987bea9216e7722c027478f26d5e8f6a (diff) | |
download | CMake-0281f9a4cad6e189601a87c9ccfba8c54e71e14b.zip CMake-0281f9a4cad6e189601a87c9ccfba8c54e71e14b.tar.gz CMake-0281f9a4cad6e189601a87c9ccfba8c54e71e14b.tar.bz2 |
cmMakefile::ConfigureFile: Accept `std::string` parameters
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.h | 3 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/CPack/cmCPackOSXX11Generator.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/cmCPackPKGGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmConfigureFileCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmCreateTestSourceList.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 11 | ||||
-rw-r--r-- | Source/cmMakefile.h | 4 | ||||
-rw-r--r-- | Source/cmOSXBundleGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 4 |
15 files changed, 41 insertions, 41 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index f522ce2..045d93d 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -618,7 +618,7 @@ bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate() std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs"; - if (!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath.c_str())) { + if (!ConfigureFile(wixTemplate, mainSourceFilePath)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Failed creating '" << mainSourceFilePath << "'' from template." << std::endl); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index fc34ef8..575254e 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1245,7 +1245,8 @@ bool cmCPackGenerator::ConfigureString(const std::string& inString, return true; } -bool cmCPackGenerator::ConfigureFile(const char* inName, const char* outName, +bool cmCPackGenerator::ConfigureFile(const std::string& inName, + const std::string& outName, bool copyOnly /* = false */) { return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true, diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 9e4bf43..3c06d41 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -169,7 +169,8 @@ protected: virtual const char* GetPackagingInstallPrefix(); virtual std::string FindTemplate(const char* name); - virtual bool ConfigureFile(const char* inName, const char* outName, + virtual bool ConfigureFile(const std::string& inName, + const std::string& outName, bool copyOnly = false); virtual bool ConfigureString(const std::string& input, std::string& output); virtual int InitializeInternal(); diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index c77eebc..6afd7d5 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -292,9 +292,8 @@ int cmCPackNSISGenerator::PackageFiles() this->SetOption("CPACK_NSIS_DEFINES", defines.c_str()); } - this->ConfigureFile(nsisInInstallOptions.c_str(), - nsisInstallOptions.c_str()); - this->ConfigureFile(nsisInFileName.c_str(), nsisFileName.c_str()); + this->ConfigureFile(nsisInInstallOptions, nsisInstallOptions); + this->ConfigureFile(nsisInFileName, nsisFileName); std::string nsisCmd = "\""; nsisCmd += this->GetOption("CPACK_INSTALLER_PROGRAM"); nsisCmd += "\" \"" + nsisFileName + "\""; diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 85248c6..90e0afe 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -83,7 +83,7 @@ int cmCPackOSXX11Generator::PackageFiles() return 0; } std::string destFileName = resourcesDirectory + "/" + iconFileName; - this->ConfigureFile(iconFile, destFileName.c_str(), true); + this->ConfigureFile(iconFile, destFileName, true); this->SetOptionIfNotSet("CPACK_APPLE_GUI_ICON", iconFileName.c_str()); } @@ -236,7 +236,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << (inFileName ? inFileName : "(NULL)") << " to " << destFileName << std::endl); - this->ConfigureFile(inFileName, destFileName.c_str()); + this->ConfigureFile(inFileName, destFileName); return true; } */ @@ -266,7 +266,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile( cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << inFileName << " to " << destFileName << std::endl); - this->ConfigureFile(inFileName.c_str(), destFileName.c_str(), copyOnly); + this->ConfigureFile(inFileName, destFileName, copyOnly); return true; } diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index d54ab56..8c22c65 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -105,7 +105,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) // Create the distribution.dist file in the metapackage to turn it // into a distribution package. - this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str()); + this->ConfigureFile(distributionTemplate, distributionFile); } void cmCPackPKGGenerator::CreateChoiceOutline( @@ -294,7 +294,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << (inFileName ? inFileName : "(NULL)") << " to " << destFileName << std::endl); - this->ConfigureFile(inFileName, destFileName.c_str()); + this->ConfigureFile(inFileName, destFileName); return true; } @@ -322,7 +322,7 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name, cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << inFileName << " to " << destFileName << std::endl); - this->ConfigureFile(inFileName.c_str(), destFileName.c_str()); + this->ConfigureFile(inFileName, destFileName); return true; } diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 8224a0f..0917d11 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -102,7 +102,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args, int cmConfigureFileCommand::ConfigureFile() { - return this->Makefile->ConfigureFile( - this->InputFile.c_str(), this->OutputFile.c_str(), this->CopyOnly, - this->AtOnly, this->EscapeQuotes, this->NewLineStyle); + return this->Makefile->ConfigureFile(this->InputFile, this->OutputFile, + this->CopyOnly, this->AtOnly, + this->EscapeQuotes, this->NewLineStyle); } diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 69532e6..b78493f 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -136,8 +136,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args, this->Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES", functionMapCode.c_str()); bool res = true; - if (!this->Makefile->ConfigureFile(configFile.c_str(), driver.c_str(), false, - true, false)) { + if (!this->Makefile->ConfigureFile(configFile, driver, false, true, false)) { res = false; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 51c001e..68de8ae 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2002,7 +2002,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // so let it replace the framework name. This avoids creating // a per-configuration Info.plist file. this->CurrentLocalGenerator->GenerateFrameworkInfoPList( - gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); + gtgt, "$(EXECUTABLE_NAME)", plist); buildSettings->AddAttribute("INFOPLIST_FILE", this->CreateString(plist)); buildSettings->AddAttribute("MACH_O_TYPE", @@ -2043,7 +2043,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // a per-configuration Info.plist file. The cfbundle plist // is very similar to the application bundle plist this->CurrentLocalGenerator->GenerateAppleInfoPList( - gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); + gtgt, "$(EXECUTABLE_NAME)", plist); buildSettings->AddAttribute("INFOPLIST_FILE", this->CreateString(plist)); } else { @@ -2077,7 +2077,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // so let it replace the framework name. This avoids creating // a per-configuration Info.plist file. this->CurrentLocalGenerator->GenerateFrameworkInfoPList( - gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); + gtgt, "$(EXECUTABLE_NAME)", plist); buildSettings->AddAttribute("INFOPLIST_FILE", this->CreateString(plist)); } else { @@ -2115,7 +2115,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // so let it replace the executable name. This avoids creating // a per-configuration Info.plist file. this->CurrentLocalGenerator->GenerateAppleInfoPList( - gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); + gtgt, "$(EXECUTABLE_NAME)", plist); buildSettings->AddAttribute("INFOPLIST_FILE", this->CreateString(plist)); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a2d0efe..fad1741 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2822,7 +2822,7 @@ static void cmLGInfoProp(cmMakefile* mf, cmGeneratorTarget* target, void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, const std::string& targetName, - const char* fname) + const std::string& fname) { // Find the Info.plist template. const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST"); @@ -2856,11 +2856,12 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, cmLGInfoProp(mf, target, "MACOSX_BUNDLE_SHORT_VERSION_STRING"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_BUNDLE_VERSION"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_COPYRIGHT"); - mf->ConfigureFile(inFile.c_str(), fname, false, false, false); + mf->ConfigureFile(inFile, fname, false, false, false); } void cmLocalGenerator::GenerateFrameworkInfoPList( - cmGeneratorTarget* target, const std::string& targetName, const char* fname) + cmGeneratorTarget* target, const std::string& targetName, + const std::string& fname) { // Find the Info.plist template. const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST"); @@ -2890,5 +2891,5 @@ void cmLocalGenerator::GenerateFrameworkInfoPList( cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_VERSION"); - mf->ConfigureFile(inFile.c_str(), fname, false, false, false); + mf->ConfigureFile(inFile, fname, false, false, false); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f9839f6..de12190 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -340,14 +340,14 @@ public: */ void GenerateAppleInfoPList(cmGeneratorTarget* target, const std::string& targetName, - const char* fname); + const std::string& fname); /** * Generate a macOS framework Info.plist file. */ void GenerateFrameworkInfoPList(cmGeneratorTarget* target, const std::string& targetName, - const char* fname); + const std::string& fname); /** Construct a comment for a custom command. */ std::string ConstructComment(cmCustomCommandGenerator const& ccg, const char* default_comment = ""); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 560181f..0a0501b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3729,22 +3729,23 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output, lineNumber, true, true); } -int cmMakefile::ConfigureFile(const char* infile, const char* outfile, - bool copyonly, bool atOnly, bool escapeQuotes, +int cmMakefile::ConfigureFile(const std::string& infile, + const std::string& outfile, bool copyonly, + bool atOnly, bool escapeQuotes, cmNewLineStyle newLine) { int res = 1; if (!this->CanIWriteThisFile(outfile)) { - cmSystemTools::Error("Attempt to write file: ", outfile, + cmSystemTools::Error("Attempt to write file: " + outfile + " into a source directory."); return 0; } if (!cmSystemTools::FileExists(infile)) { - cmSystemTools::Error("File ", infile, " does not exist."); + cmSystemTools::Error("File " + infile + " does not exist."); return 0; } std::string soutfile = outfile; - std::string sinfile = infile; + const std::string& sinfile = infile; this->AddCMakeDependFile(sinfile); cmSystemTools::ConvertToUnixSlashes(soutfile); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 0800ce4..88b4c2f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -610,8 +610,8 @@ public: /** * Copy file but change lines according to ConfigureString */ - int ConfigureFile(const char* infile, const char* outfile, bool copyonly, - bool atOnly, bool escapeQuotes, + int ConfigureFile(const std::string& infile, const std::string& outfile, + bool copyonly, bool atOnly, bool escapeQuotes, cmNewLineStyle = cmNewLineStyle()); /** diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 6857d5a..47a8df4 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -54,8 +54,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, plist += this->GT->GetAppBundleDirectory(this->ConfigName, cmGeneratorTarget::ContentLevel); plist += "/Info.plist"; - this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName, - plist.c_str()); + this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName, plist); this->Makefile->AddCMakeOutputFile(plist); outpath = out; } @@ -90,8 +89,7 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, } plist += "/Info.plist"; std::string name = cmSystemTools::GetFilenameName(targetName); - this->LocalGenerator->GenerateFrameworkInfoPList(this->GT, name, - plist.c_str()); + this->LocalGenerator->GenerateFrameworkInfoPList(this->GT, name, plist); // Generate Versions directory only for MacOSX frameworks if (this->Makefile->PlatformIsAppleEmbedded()) { @@ -184,7 +182,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, cmGeneratorTarget::ContentLevel); plist += "/Info.plist"; std::string name = cmSystemTools::GetFilenameName(targetName); - this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist.c_str()); + this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist); this->Makefile->AddCMakeOutputFile(plist); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 00a2d74..6ee82f4 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -622,8 +622,8 @@ void cmVisualStudio10TargetGenerator::Generate() propsLocal += this->DefaultArtifactDir; propsLocal += "\\nasm.props"; ConvertToWindowsSlash(propsLocal); - this->Makefile->ConfigureFile(propsTemplate.c_str(), - propsLocal.c_str(), false, true, true); + this->Makefile->ConfigureFile(propsTemplate, propsLocal, false, true, + true); Elem(e1, "Import").Attribute("Project", propsLocal); } } |