diff options
author | Brad King <brad.king@kitware.com> | 2024-03-06 21:00:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-03-22 13:51:06 (GMT) |
commit | 438809d3ba074356a641f0a1665a8c3b6117648e (patch) | |
tree | 4aa8cfcdc5e0e7d87fc2d38f625ed169b0fbba1c /Source/CPack/cmCPackGenerator.cxx | |
parent | 4d661e3a92b09362d4749af24e1cac79071adcfb (diff) | |
download | CMake-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/cmCPackGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 10 |
1 files changed, 6 insertions, 4 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(); |