Commit 7f2bb732 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'source_sweep_cmStrCat'

9b334397 Source sweep: Use cmStrCat for string concatenation
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Rolf Eike Beer's avatarRolf Eike Beer <eike@sf-mail.de>
Acked-by: Daniel Pfeifer's avatarDaniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !3699
parents 68126f5a 9b334397
Pipeline #144608 passed with stage
in 0 seconds
...@@ -35,8 +35,7 @@ int cmCPackIFWGenerator::PackageFiles() ...@@ -35,8 +35,7 @@ int cmCPackIFWGenerator::PackageFiles()
this->Installer.GeneratePackageFiles(); this->Installer.GeneratePackageFiles();
std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string ifwTmpFile = ifwTLD; std::string ifwTmpFile = cmStrCat(ifwTLD, "/IFWOutput.log");
ifwTmpFile += "/IFWOutput.log";
// Run repogen // Run repogen
if (!this->Installer.RemoteRepositories.empty()) { if (!this->Installer.RemoteRepositories.empty()) {
...@@ -117,8 +116,8 @@ int cmCPackIFWGenerator::PackageFiles() ...@@ -117,8 +116,8 @@ int cmCPackIFWGenerator::PackageFiles()
// Run binary creator // Run binary creator
{ {
std::string ifwCmd = this->BinCreator; std::string ifwCmd =
ifwCmd += " -c " + this->toplevel + "/config/config.xml"; cmStrCat(this->BinCreator, " -c ", this->toplevel, "/config/config.xml");
if (!this->Installer.Resources.empty()) { if (!this->Installer.Resources.empty()) {
ifwCmd += " -r "; ifwCmd += " -r ";
......
...@@ -193,8 +193,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions() ...@@ -193,8 +193,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->TargetDir = optIFW_TARGET_DIRECTORY; this->TargetDir = optIFW_TARGET_DIRECTORY;
} else if (const char* optPACKAGE_INSTALL_DIRECTORY = } else if (const char* optPACKAGE_INSTALL_DIRECTORY =
this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) { this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
this->TargetDir = "@ApplicationsDir@/"; this->TargetDir =
this->TargetDir += optPACKAGE_INSTALL_DIRECTORY; cmStrCat("@ApplicationsDir@/", optPACKAGE_INSTALL_DIRECTORY);
} else { } else {
this->TargetDir = "@RootDir@/usr/local"; this->TargetDir = "@RootDir@/usr/local";
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "cmStringAlgorithms.h" #include "cmStringAlgorithms.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmUuid.h" #include "cmUuid.h"
#include "cm_string_view.hxx"
#include <algorithm> #include <algorithm>
#include "cmWIXDirectoriesSourceWriter.h" #include "cmWIXDirectoriesSourceWriter.h"
...@@ -519,9 +520,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() ...@@ -519,9 +520,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
for (auto const& i : this->Components) { for (auto const& i : this->Components) {
cmCPackComponent const& component = i.second; cmCPackComponent const& component = i.second;
std::string componentPath = toplevel; std::string componentPath = cmStrCat(toplevel, '/', component.Name);
componentPath += "/";
componentPath += component.Name;
std::string const componentFeatureId = "CM_C_" + component.Name; std::string const componentFeatureId = "CM_C_" + component.Name;
...@@ -1087,8 +1086,7 @@ std::string cmCPackWIXGenerator::CreateHashedId( ...@@ -1087,8 +1086,7 @@ std::string cmCPackWIXGenerator::CreateHashedId(
cmCryptoHash sha1(cmCryptoHash::AlgoSHA1); cmCryptoHash sha1(cmCryptoHash::AlgoSHA1);
std::string const hash = sha1.HashString(path); std::string const hash = sha1.HashString(path);
std::string identifier; std::string identifier = cmStrCat(cm::string_view(hash).substr(0, 7), '_');
identifier += hash.substr(0, 7) + "_";
const size_t maxFileNameLength = 52; const size_t maxFileNameLength = 52;
if (normalizedFilename.length() > maxFileNameLength) { if (normalizedFilename.length() > maxFileNameLength) {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "cmCPackGenerator.h" #include "cmCPackGenerator.h"
#include "cmCPackLog.h" #include "cmCPackLog.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmWorkingDirectory.h" #include "cmWorkingDirectory.h"
...@@ -71,8 +72,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( ...@@ -71,8 +72,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
} }
std::string filePrefix; std::string filePrefix;
if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) {
filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); filePrefix = cmStrCat(this->GetOption("CPACK_PACKAGE_FILE_NAME"), '/');
filePrefix += "/";
} }
const char* installPrefix = const char* installPrefix =
this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
......
...@@ -41,9 +41,8 @@ int cmCPackBundleGenerator::InitializeInternal() ...@@ -41,9 +41,8 @@ int cmCPackBundleGenerator::InitializeInternal()
const char* cmCPackBundleGenerator::GetPackagingInstallPrefix() const char* cmCPackBundleGenerator::GetPackagingInstallPrefix()
{ {
this->InstallPrefix = "/"; this->InstallPrefix = cmStrCat('/', this->GetOption("CPACK_BUNDLE_NAME"),
this->InstallPrefix += this->GetOption("CPACK_BUNDLE_NAME"); ".app/Contents/Resources");
this->InstallPrefix += ".app/Contents/Resources";
return this->InstallPrefix.c_str(); return this->InstallPrefix.c_str();
} }
...@@ -191,9 +190,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) ...@@ -191,9 +190,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
if (!cpack_apple_cert_app.empty()) { if (!cpack_apple_cert_app.empty()) {
std::string output; std::string output;
std::string bundle_path; std::string bundle_path;
bundle_path = src_dir + "/"; bundle_path =
bundle_path += this->GetOption("CPACK_BUNDLE_NAME"); cmStrCat(src_dir, '/', this->GetOption("CPACK_BUNDLE_NAME"), ".app");
bundle_path += ".app";
// A list of additional files to sign, ie. frameworks and plugins. // A list of additional files to sign, ie. frameworks and plugins.
const std::string sign_parameter = const std::string sign_parameter =
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */ file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackComponentGroup.h" #include "cmCPackComponentGroup.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include <string> #include <string>
...@@ -14,9 +15,7 @@ unsigned long cmCPackComponent::GetInstalledSize( ...@@ -14,9 +15,7 @@ unsigned long cmCPackComponent::GetInstalledSize(
} }
for (std::string const& file : this->Files) { for (std::string const& file : this->Files) {
std::string path = installDir; std::string path = cmStrCat(installDir, '/', file);
path += '/';
path += file;
this->TotalSize += cmSystemTools::FileLength(path); this->TotalSize += cmSystemTools::FileLength(path);
} }
......
...@@ -28,13 +28,11 @@ int cmCPackCygwinBinaryGenerator::InitializeInternal() ...@@ -28,13 +28,11 @@ int cmCPackCygwinBinaryGenerator::InitializeInternal()
int cmCPackCygwinBinaryGenerator::PackageFiles() int cmCPackCygwinBinaryGenerator::PackageFiles()
{ {
std::string packageName = this->GetOption("CPACK_PACKAGE_NAME"); std::string packageName =
packageName += "-"; cmStrCat(this->GetOption("CPACK_PACKAGE_NAME"), '-',
packageName += this->GetOption("CPACK_PACKAGE_VERSION"); this->GetOption("CPACK_PACKAGE_VERSION"));
packageName = cmsys::SystemTools::LowerCase(packageName); packageName = cmsys::SystemTools::LowerCase(packageName);
std::string manifest = "/usr/share/doc/"; std::string manifest = cmStrCat("/usr/share/doc/", packageName, "/MANIFEST");
manifest += packageName;
manifest += "/MANIFEST";
std::string manifestFile = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); std::string manifestFile = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
// Create a MANIFEST file that contains all of the files in // Create a MANIFEST file that contains all of the files in
// the tar file // the tar file
......
...@@ -37,8 +37,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles() ...@@ -37,8 +37,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
{ {
// Create a tar file of the sources // Create a tar file of the sources
std::string packageDirFileName = std::string packageDirFileName =
this->GetOption("CPACK_TEMPORARY_DIRECTORY"); cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".tar.bz2");
packageDirFileName += ".tar.bz2";
packageFileNames[0] = packageDirFileName; packageFileNames[0] = packageDirFileName;
std::string output; std::string output;
// skip one parent up to the cmCPackTarBZip2Generator // skip one parent up to the cmCPackTarBZip2Generator
...@@ -94,8 +93,8 @@ int cmCPackCygwinSourceGenerator::PackageFiles() ...@@ -94,8 +93,8 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
<< this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n"); << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
return 0; return 0;
} }
std::string outerTarFile = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); std::string outerTarFile =
outerTarFile += "-"; cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), '-');
const char* patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER"); const char* patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
if (!patch) { if (!patch) {
cmCPackLogger(cmCPackLog::LOG_WARNING, cmCPackLogger(cmCPackLog::LOG_WARNING,
...@@ -106,19 +105,18 @@ int cmCPackCygwinSourceGenerator::PackageFiles() ...@@ -106,19 +105,18 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
outerTarFile += patch; outerTarFile += patch;
outerTarFile += "-src.tar.bz2"; outerTarFile += "-src.tar.bz2";
std::string tmpDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string tmpDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string buildScript = tmpDir; std::string buildScript =
buildScript += "/"; cmStrCat(tmpDir, '/',
buildScript += cmSystemTools::GetFilenameName( cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT")); this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT")));
std::string patchFile = tmpDir; std::string patchFile =
patchFile += "/"; cmStrCat(tmpDir, '/',
patchFile += cmSystemTools::GetFilenameName(
cmSystemTools::GetFilenameName(this->GetOption("CPACK_CYGWIN_PATCH_FILE")); this->GetOption("CPACK_CYGWIN_PATCH_FILE")));
std::string file = cmSystemTools::GetFilenameName(compressOutFile); std::string file = cmSystemTools::GetFilenameName(compressOutFile);
std::string sourceTar = cmSystemTools::GetFilenamePath(compressOutFile); std::string sourceTar =
sourceTar += "/"; cmStrCat(cmSystemTools::GetFilenamePath(compressOutFile), '/', file);
sourceTar += file;
/* reset list of file to be packaged */ /* reset list of file to be packaged */
files.clear(); files.clear();
// a source release in cygwin should have the build script used // a source release in cygwin should have the build script used
...@@ -140,8 +138,8 @@ int cmCPackCygwinSourceGenerator::PackageFiles() ...@@ -140,8 +138,8 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix() const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix()
{ {
this->InstallPrefix = "/"; this->InstallPrefix =
this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME"); cmStrCat('/', this->GetOption("CPACK_PACKAGE_FILE_NAME"));
return this->InstallPrefix.c_str(); return this->InstallPrefix.c_str();
} }
......
...@@ -149,8 +149,7 @@ void DebGenerator::generateControlFile() const ...@@ -149,8 +149,7 @@ void DebGenerator::generateControlFile() const
unsigned long totalSize = 0; unsigned long totalSize = 0;
{ {
std::string dirName = TemporaryDir; std::string dirName = cmStrCat(TemporaryDir, '/');
dirName += '/';
for (std::string const& file : PackageFiles) { for (std::string const& file : PackageFiles) {
totalSize += cmSystemTools::FileLength(file); totalSize += cmSystemTools::FileLength(file);
} }
...@@ -248,8 +247,7 @@ std::string DebGenerator::generateMD5File() const ...@@ -248,8 +247,7 @@ std::string DebGenerator::generateMD5File() const
cmGeneratedFileStream out(md5filename); cmGeneratedFileStream out(md5filename);
std::string topLevelWithTrailingSlash = TemporaryDir; std::string topLevelWithTrailingSlash = cmStrCat(TemporaryDir, '/');
topLevelWithTrailingSlash += '/';
for (std::string const& file : PackageFiles) { for (std::string const& file : PackageFiles) {
// hash only regular files // hash only regular files
if (cmSystemTools::FileIsDirectory(file) || if (cmSystemTools::FileIsDirectory(file) ||
...@@ -469,8 +467,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, ...@@ -469,8 +467,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
// Tell CPackDeb.cmake the name of the component GROUP. // Tell CPackDeb.cmake the name of the component GROUP.
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT", packageName.c_str()); this->SetOption("CPACK_DEB_PACKAGE_COMPONENT", packageName.c_str());
// Tell CPackDeb.cmake the path where the component is. // Tell CPackDeb.cmake the path where the component is.
std::string component_path = "/"; std::string component_path = cmStrCat('/', packageName);
component_path += packageName;
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
component_path.c_str()); component_path.c_str());
if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) { if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) {
...@@ -500,9 +497,8 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, ...@@ -500,9 +497,8 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
retval = 0; retval = 0;
} }
// add the generated package to package file names list // add the generated package to package file names list
packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); packageFileName = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/',
packageFileName += "/"; this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"));
packageFileName += this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME");
packageFileNames.push_back(std::move(packageFileName)); packageFileNames.push_back(std::move(packageFileName));
if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE")) { if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE")) {
...@@ -524,9 +520,9 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, ...@@ -524,9 +520,9 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
retval = 0; retval = 0;
} }
// add the generated package to package file names list // add the generated package to package file names list
packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); packageFileName =
packageFileName += "/"; cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/',
packageFileName += this->GetOption("GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME"); this->GetOption("GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME"));
packageFileNames.push_back(std::move(packageFileName)); packageFileNames.push_back(std::move(packageFileName));
} }
...@@ -614,8 +610,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( ...@@ -614,8 +610,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(
if (!compInstDirName.empty()) { if (!compInstDirName.empty()) {
// Tell CPackDeb.cmake the path where the component is. // Tell CPackDeb.cmake the path where the component is.
std::string component_path = "/"; std::string component_path = cmStrCat('/', compInstDirName);
component_path += compInstDirName;
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
component_path.c_str()); component_path.c_str());
} }
...@@ -644,9 +639,8 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( ...@@ -644,9 +639,8 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(
retval = 0; retval = 0;
} }
// add the generated package to package file names list // add the generated package to package file names list
packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); packageFileName = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/',
packageFileName += "/"; this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"));
packageFileName += this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME");
packageFileNames.push_back(std::move(packageFileName)); packageFileNames.push_back(std::move(packageFileName));
return retval; return retval;
} }
......
...@@ -196,9 +196,7 @@ int cmCPackDragNDropGenerator::PackageFiles() ...@@ -196,9 +196,7 @@ int cmCPackDragNDropGenerator::PackageFiles()
full_package_name += std::string(GetOutputExtension()); full_package_name += std::string(GetOutputExtension());
packageFileNames.push_back(full_package_name); packageFileNames.push_back(full_package_name);
std::string src_dir = toplevel; std::string src_dir = cmStrCat(toplevel, '/', package_file);
src_dir += "/";
src_dir += package_file;
if (0 == this->CreateDMG(src_dir, full_package_name)) { if (0 == this->CreateDMG(src_dir, full_package_name)) {
return 0; return 0;
...@@ -409,8 +407,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ...@@ -409,8 +407,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
} }
// Create a temporary read-write disk image ... // Create a temporary read-write disk image ...
std::string temp_image = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string temp_image =
temp_image += "/temp.dmg"; cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/temp.dmg");
std::string create_error; std::string create_error;
std::ostringstream temp_image_command; std::ostringstream temp_image_command;
...@@ -522,8 +520,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ...@@ -522,8 +520,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
if (!cpack_license_file.empty() || !slaDirectory.empty()) { if (!cpack_license_file.empty() || !slaDirectory.empty()) {
// Use old hardcoded style if sla_dir is not set // Use old hardcoded style if sla_dir is not set
bool oldStyle = slaDirectory.empty(); bool oldStyle = slaDirectory.empty();
std::string sla_r = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string sla_r =
sla_r += "/sla.r"; cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/sla.r");
std::vector<std::string> languages; std::vector<std::string> languages;
if (!oldStyle) { if (!oldStyle) {
...@@ -649,8 +647,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ...@@ -649,8 +647,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
if (temp_image_format != "UDZO") { if (temp_image_format != "UDZO") {
temp_image_format = "UDZO"; temp_image_format = "UDZO";
// convert to UDZO to enable unflatten/flatten // convert to UDZO to enable unflatten/flatten
std::string temp_udzo = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string temp_udzo = cmStrCat(
temp_udzo += "/temp-udzo.dmg"; this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/temp-udzo.dmg");
std::ostringstream udco_image_command; std::ostringstream udco_image_command;
udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
......
...@@ -73,8 +73,8 @@ int cmCPackGenerator::PrepareNames() ...@@ -73,8 +73,8 @@ int cmCPackGenerator::PrepareNames()
} }
} }
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY"); std::string tempDirectory =
tempDirectory += "/_CPack_Packages/"; cmStrCat(this->GetOption("CPACK_PACKAGE_DIRECTORY"), "/_CPack_Packages/");
const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG"); const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
if (toplevelTag) { if (toplevelTag) {
tempDirectory += toplevelTag; tempDirectory += toplevelTag;
...@@ -197,8 +197,7 @@ int cmCPackGenerator::InstallProject() ...@@ -197,8 +197,7 @@ int cmCPackGenerator::InstallProject()
} }
if (setDestDir) { if (setDestDir) {
std::string destDir = "DESTDIR="; std::string destDir = cmStrCat("DESTDIR=", tempInstallDirectory);
destDir += tempInstallDirectory;
cmSystemTools::PutEnv(destDir); cmSystemTools::PutEnv(destDir);
} else { } else {
// Make sure there is no destdir // Make sure there is no destdir
...@@ -271,8 +270,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( ...@@ -271,8 +270,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
(void)setDestDir; (void)setDestDir;
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS"); const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
if (installCommands && *installCommands) { if (installCommands && *installCommands) {
std::string tempInstallDirectoryEnv = "CMAKE_INSTALL_PREFIX="; std::string tempInstallDirectoryEnv =
tempInstallDirectoryEnv += tempInstallDirectory; cmStrCat("CMAKE_INSTALL_PREFIX=", tempInstallDirectory);
cmSystemTools::PutEnv(tempInstallDirectoryEnv); cmSystemTools::PutEnv(tempInstallDirectoryEnv);
std::vector<std::string> installCommandsVector; std::vector<std::string> installCommandsVector;
cmExpandList(installCommands, installCommandsVector); cmExpandList(installCommands, installCommandsVector);
...@@ -284,8 +283,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( ...@@ -284,8 +283,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
ic, &output, &output, &retVal, nullptr, this->GeneratorVerbose, ic, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero()); cmDuration::zero());
if (!resB || retVal) { if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string tmpFile = cmStrCat(
tmpFile += "/InstallOutput.log"; this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/InstallOutput.log");
cmGeneratedFileStream ofs(tmpFile); cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << ic << std::endl ofs << "# Run command: " << ic << std::endl
<< "# Output:" << std::endl << "# Output:" << std::endl
...@@ -343,8 +342,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( ...@@ -343,8 +342,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
std::string top = *it; std::string top = *it;
it++; it++;
std::string subdir = *it; std::string subdir = *it;
std::string findExpr = top; std::string findExpr = cmStrCat(top, "/*");
findExpr += "/*";
cmCPackLogger(cmCPackLog::LOG_OUTPUT, cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install directory: " << top << std::endl); "- Install directory: " << top << std::endl);
gl.RecurseOn(); gl.RecurseOn();
...@@ -372,8 +370,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( ...@@ -372,8 +370,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
if (skip) { if (skip) {
continue; continue;
} }
std::string filePath = tempDir; std::string filePath = cmStrCat(tempDir, '/', subdir, '/',
filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(top, gf); cmSystemTools::RelativePath(top, gf));
cmCPackLogger(cmCPackLog::LOG_DEBUG, cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Copy file: " << inFile << " -> " << filePath "Copy file: " << inFile << " -> " << filePath
<< std::endl); << std::endl);
...@@ -398,8 +396,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( ...@@ -398,8 +396,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
/* rebuild symlinks in the installed tree */ /* rebuild symlinks in the installed tree */
if (!symlinkedFiles.empty()) { if (!symlinkedFiles.empty()) {
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory(); std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
std::string goToDir = tempDir; std::string goToDir = cmStrCat(tempDir, '/', subdir);
goToDir += "/" + subdir;
cmCPackLogger(cmCPackLog::LOG_DEBUG, cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Change dir to: " << goToDir << std::endl); "Change dir to: " << goToDir << std::endl);
cmWorkingDirectory workdir(goToDir); cmWorkingDirectory workdir(goToDir);
...@@ -662,8 +659,8 @@ int cmCPackGenerator::RunPreinstallTarget( ...@@ -662,8 +659,8 @@ int cmCPackGenerator::RunPreinstallTarget(
buildCommand, &output, &output, &retVal, installDirectory.c_str(), buildCommand, &output, &output, &retVal, installDirectory.c_str(),
this->GeneratorVerbose, cmDuration::zero()); this->GeneratorVerbose, cmDuration::zero());
if (!resB || retVal) { if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string tmpFile = cmStrCat(
tmpFile += "/PreinstallOutput.log"; this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/PreinstallOutput.log");
cmGeneratedFileStream ofs(tmpFile); cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << buildCommand << std::endl ofs << "# Run command: " << buildCommand << std::endl
<< "# Directory: " << installDirectory << std::endl << "# Directory: " << installDirectory << std::endl
...@@ -911,10 +908,8 @@ int cmCPackGenerator::InstallCMakeProject( ...@@ -911,10 +908,8 @@ int cmCPackGenerator::InstallCMakeProject(
GetComponentInstallDirNameSuffix(component); GetComponentInstallDirNameSuffix(component);
if (nullptr != this->GetOption(absoluteDestFileComponent)) { if (nullptr != this->GetOption(absoluteDestFileComponent)) {
std::string absoluteDestFilesListComponent = std::string absoluteDestFilesListComponent =
this->GetOption(absoluteDestFileComponent); cmStrCat(this->GetOption(absoluteDestFileComponent), ';',
absoluteDestFilesListComponent += ";"; mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
absoluteDestFilesListComponent +=
mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
this->SetOption(absoluteDestFileComponent, this->SetOption(absoluteDestFileComponent,
absoluteDestFilesListComponent.c_str()); absoluteDestFilesListComponent.c_str());
} else { } else {
...@@ -1006,8 +1001,7 @@ int cmCPackGenerator::DoPackage() ...@@ -1006,8 +1001,7 @@ int cmCPackGenerator::DoPackage()
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl; cmsys::Glob gl;
std::string findExpr = tempDirectory; std::string findExpr = cmStrCat(tempDirectory, "/*");
findExpr += "/*";
gl.RecurseOn(); gl.RecurseOn();
gl.SetRecurseListDirs(true); gl.SetRecurseListDirs(true);
gl.SetRecurseThroughSymlinks(false); gl.SetRecurseThroughSymlinks(false);
...@@ -1203,8 +1197,7 @@ const char* cmCPackGenerator::GetInstallPath() ...@@ -1203,8 +1197,7 @@ const char* cmCPackGenerator::GetInstallPath()
if (cmsys::SystemTools::GetEnv("ProgramFiles", prgfiles)) { if (cmsys::SystemTools::GetEnv("ProgramFiles", prgfiles)) {
this->InstallPath = prgfiles; this->InstallPath = prgfiles;
} else if (cmsys::SystemTools::GetEnv("SystemDrive", sysDrive)) { } else if (cmsys::SystemTools::GetEnv("SystemDrive", sysDrive)) {
this->InstallPath = sysDrive; this->InstallPath = cmStrCat(sysDrive, "/Program Files");
this->InstallPath += "/Program Files";
} else { } else {
this->InstallPath = "c:/Program Files"; this->InstallPath = "c:/Program Files";
} }
......
...@@ -56,8 +56,7 @@ int cmCPackNSISGenerator::PackageFiles() ...@@ -56,8 +56,7 @@ int cmCPackNSISGenerator::PackageFiles()
} }
std::string nsisFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string nsisFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string tmpFile = nsisFileName; std::string tmpFile = cmStrCat(nsisFileName, "/NSISOutput.log");