mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 07:11:52 +08:00
Refactor: Generalize cmExportInstallFileGenerator::ReplaceInstallPrefix()
This commit is contained in:
@@ -258,15 +258,7 @@ void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os)
|
|||||||
|
|
||||||
void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
|
void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
|
||||||
{
|
{
|
||||||
std::string::size_type pos = 0;
|
cmGeneratorExpression::ReplaceInstallPrefix(input, "${_IMPORT_PREFIX}");
|
||||||
std::string::size_type lastPos = pos;
|
|
||||||
|
|
||||||
while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
|
|
||||||
std::string::npos) {
|
|
||||||
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
|
|
||||||
input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
|
|
||||||
lastPos = endPos;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmExportInstallFileGenerator::GenerateImportFileConfig(
|
bool cmExportInstallFileGenerator::GenerateImportFileConfig(
|
||||||
|
@@ -385,6 +385,20 @@ bool cmGeneratorExpression::IsValidTargetName(const std::string& input)
|
|||||||
return targetNameValidator.find(input);
|
return targetNameValidator.find(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmGeneratorExpression::ReplaceInstallPrefix(
|
||||||
|
std::string& input, const std::string& replacement)
|
||||||
|
{
|
||||||
|
std::string::size_type pos = 0;
|
||||||
|
std::string::size_type lastPos = pos;
|
||||||
|
|
||||||
|
while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
|
||||||
|
std::string::npos) {
|
||||||
|
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
|
||||||
|
input.replace(pos, endPos - pos, replacement);
|
||||||
|
lastPos = endPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
|
void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
|
||||||
const cmGeneratorTarget* tgt, std::map<std::string, std::string>& mapping)
|
const cmGeneratorTarget* tgt, std::map<std::string, std::string>& mapping)
|
||||||
{
|
{
|
||||||
|
@@ -87,6 +87,9 @@ public:
|
|||||||
return input != nullptr && input[0] == '$' && input[1] == '<';
|
return input != nullptr && input[0] == '$' && input[1] == '<';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ReplaceInstallPrefix(std::string& input,
|
||||||
|
const std::string& replacement);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmListFileBacktrace Backtrace;
|
cmListFileBacktrace Backtrace;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user