mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
cmCPackGenerator: Add option to FindTemplate to use alternate builtin path
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user