diff options
Diffstat (limited to 'Source/CPack/cmCPackNSISGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 363f536..9afdc62 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -68,7 +68,7 @@ int cmCPackNSISGenerator::PackageFiles() // Use the custom component install directory if we have one if (pos != std::string::npos) { - const std::string componentName = fileN.substr(0, pos); + auto componentName = cm::string_view(fileN).substr(0, pos); outputDir = CustomComponentInstallDirectory(componentName); } else { outputDir = CustomComponentInstallDirectory(fileN); @@ -103,7 +103,7 @@ int cmCPackNSISGenerator::PackageFiles() componentName = fileN.substr(0, slash); // Strip off the component part of the path. - fileN = fileN.substr(slash + 1); + fileN.erase(0, slash + 1); } } std::replace(fileN.begin(), fileN.end(), '/', '\\'); @@ -453,12 +453,12 @@ int cmCPackNSISGenerator::InitializeInternal() } if (versionRex.find(output)) { double nsisVersion = atof(versionRex.match(1).c_str()); - double minNSISVersion = 2.09; + double minNSISVersion = 3.0; cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: " << nsisVersion << std::endl); if (nsisVersion < minNSISVersion) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "CPack requires NSIS Version 2.09 or greater. " + "CPack requires NSIS Version 3.0 or greater. " "NSIS found on the system was: " << nsisVersion << std::endl); return 0; @@ -672,7 +672,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( const std::string componentOutputDir = CustomComponentInstallDirectory(component->Name); - componentCode += " SetOutPath \"" + componentOutputDir + "\"\n"; + componentCode += cmStrCat(" SetOutPath \"", componentOutputDir, "\"\n"); // Create the actual installation commands if (component->IsDownloaded) { @@ -921,12 +921,11 @@ std::string cmCPackNSISGenerator::CreateComponentGroupDescription( } std::string cmCPackNSISGenerator::CustomComponentInstallDirectory( - const std::string& componentName) + cm::string_view componentName) { - const char* outputDir = - this->GetOption("CPACK_NSIS_" + componentName + "_INSTALL_DIRECTORY"); - const std::string componentOutputDir = (outputDir ? outputDir : "$INSTDIR"); - return componentOutputDir; + const char* outputDir = this->GetOption( + cmStrCat("CPACK_NSIS_", componentName, "_INSTALL_DIRECTORY")); + return outputDir ? outputDir : "$INSTDIR"; } std::string cmCPackNSISGenerator::TranslateNewlines(std::string str) |