summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-03-06 21:00:11 (GMT)
committerBrad King <brad.king@kitware.com>2024-03-22 13:51:06 (GMT)
commit438809d3ba074356a641f0a1665a8c3b6117648e (patch)
tree4aa8cfcdc5e0e7d87fc2d38f625ed169b0fbba1c /Source/CPack
parent4d661e3a92b09362d4749af24e1cac79071adcfb (diff)
downloadCMake-438809d3ba074356a641f0a1665a8c3b6117648e.zip
CMake-438809d3ba074356a641f0a1665a8c3b6117648e.tar.gz
CMake-438809d3ba074356a641f0a1665a8c3b6117648e.tar.bz2
cmCPackGenerator: Add option to FindTemplate to use alternate builtin path
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackGenerator.h6
2 files changed, 11 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 8f72ceb..b7786d3 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -7,6 +7,8 @@
#include <memory>
#include <utility>
+#include <cmext/string_view>
+
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
@@ -1315,17 +1317,17 @@ const char* cmCPackGenerator::GetPackagingInstallPrefix()
return this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")->c_str();
}
-std::string cmCPackGenerator::FindTemplate(const char* name)
+std::string cmCPackGenerator::FindTemplate(cm::string_view name,
+ cm::optional<cm::string_view> alt)
{
cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "Look for template: " << (name ? name : "(NULL)")
- << std::endl);
+ "Look for template: " << name << std::endl);
// Search CMAKE_MODULE_PATH for a custom template.
std::string ffile = this->MakefileMap->GetModulesFile(name);
if (ffile.empty()) {
// Fall back to our internal builtin default.
ffile = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/Internal/CPack/",
- name);
+ alt ? *alt : ""_s, name);
cmSystemTools::ConvertToUnixSlashes(ffile);
if (!cmSystemTools::FileExists(ffile)) {
ffile.clear();
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 8078d9f..223b720 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -9,6 +9,9 @@
#include <string>
#include <vector>
+#include <cm/optional>
+#include <cm/string_view>
+
#include "cm_sys_stat.h"
#include "cmCPackComponentGroup.h"
@@ -179,7 +182,8 @@ protected:
virtual const char* GetInstallPath();
virtual const char* GetPackagingInstallPrefix();
- virtual std::string FindTemplate(const char* name);
+ std::string FindTemplate(cm::string_view name,
+ cm::optional<cm::string_view> alt = cm::nullopt);
virtual bool ConfigureFile(const std::string& inName,
const std::string& outName,
bool copyOnly = false);