summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-07-30 14:21:43 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-07-30 14:21:52 (GMT)
commit2903eb1963255296649f1cb17ac34751e31a8004 (patch)
treef186cc924dcb189b0e90e3010ba06ecc680bc84e
parent40214f0def566238c4930415ba6eaca1d760918e (diff)
parent8178fd43e9480384d914bfb2e4bca19991125801 (diff)
downloadCMake-2903eb1963255296649f1cb17ac34751e31a8004.zip
CMake-2903eb1963255296649f1cb17ac34751e31a8004.tar.gz
CMake-2903eb1963255296649f1cb17ac34751e31a8004.tar.bz2
Merge topic 'export-refactor-more-for-cps'
8178fd43e9 export: Fix handling of import prefix e5b73b60e3 export: Generalize GenerateImportFileConfig cd217739f7 export: Refactor obtaining export information Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9684
-rw-r--r--Source/cmExportBuildFileGenerator.cxx18
-rw-r--r--Source/cmExportBuildFileGenerator.h6
-rw-r--r--Source/cmExportFileGenerator.h10
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.h2
-rw-r--r--Source/cmExportInstallCMakeConfigGenerator.cxx38
-rw-r--r--Source/cmExportInstallCMakeConfigGenerator.h7
-rw-r--r--Source/cmExportInstallFileGenerator.cxx117
-rw-r--r--Source/cmExportInstallFileGenerator.h12
-rw-r--r--Source/cmExportTryCompileFileGenerator.h5
-rw-r--r--Source/cmGeneratorExpression.cxx14
-rw-r--r--Source/cmGeneratorExpression.h4
11 files changed, 131 insertions, 102 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index eefc516..a319f0c 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -138,11 +138,8 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
{
// The target is not in the export.
if (!this->AppendMode) {
- std::string const& name = dependee->GetName();
- cmGlobalGenerator* gg =
- dependee->GetLocalGenerator()->GetGlobalGenerator();
- auto exportInfo = this->FindBuildExportInfo(gg, name);
- std::vector<std::string> const& exportFiles = exportInfo.first;
+ auto const& exportInfo = this->FindExportInfo(dependee);
+ auto const& exportFiles = exportInfo.first;
if (exportFiles.size() == 1) {
std::string missingTarget = exportInfo.second;
@@ -178,14 +175,15 @@ void cmExportBuildFileGenerator::GetTargets(
targets = this->Targets;
}
-std::pair<std::vector<std::string>, std::string>
-cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
- std::string const& name)
+cmExportFileGenerator::ExportInfo cmExportBuildFileGenerator::FindExportInfo(
+ cmGeneratorTarget const* target) const
{
std::vector<std::string> exportFiles;
std::string ns;
- auto& exportSets = gg->GetBuildExportSets();
+ auto const& name = target->GetName();
+ auto& exportSets =
+ target->GetLocalGenerator()->GetGlobalGenerator()->GetBuildExportSets();
for (auto const& exp : exportSets) {
auto const& exportSet = exp.second;
@@ -199,7 +197,7 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
}
}
- return { exportFiles, ns };
+ return { exportFiles, exportFiles.size() == 1 ? ns : std::string{} };
}
void cmExportBuildFileGenerator::ComplainAboutMissingTarget(
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index a4f8c5f..dfd0416 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -16,7 +16,6 @@
class cmExportSet;
class cmGeneratorTarget;
-class cmGlobalGenerator;
class cmLocalGenerator;
/** \class cmExportBuildCMakeConfigGenerator
@@ -82,7 +81,7 @@ protected:
void ComplainAboutMissingTarget(
cmGeneratorTarget const* depender, cmGeneratorTarget const* dependee,
- std::vector<std::string> const& namespaces) const;
+ std::vector<std::string> const& exportFiles) const;
void ComplainAboutDuplicateTarget(
std::string const& targetName) const override;
@@ -105,8 +104,7 @@ protected:
return this->CxxModulesDirectory;
}
- std::pair<std::vector<std::string>, std::string> FindBuildExportInfo(
- cmGlobalGenerator* gg, std::string const& name);
+ ExportInfo FindExportInfo(cmGeneratorTarget const* target) const override;
using cmExportFileGenerator::PopulateInterfaceProperties;
bool PopulateInterfaceProperties(cmGeneratorTarget const* target,
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 89295f5..f765493 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -8,6 +8,7 @@
#include <map>
#include <set>
#include <string>
+#include <utility>
#include <vector>
#include <cm/string_view>
@@ -86,7 +87,8 @@ protected:
/** Generate per-configuration target information to the given output
stream. */
- void GenerateImportConfig(std::ostream& os, std::string const& config);
+ virtual void GenerateImportConfig(std::ostream& os,
+ std::string const& config);
/** Each subclass knows where the target files are located. */
virtual void GenerateImportTargetsConfig(std::ostream& os,
@@ -126,6 +128,12 @@ protected:
virtual void ReportError(std::string const& errorMessage) const = 0;
+ using ExportInfo = std::pair<std::vector<std::string>, std::string>;
+
+ /** Find the set of export files and the unique namespace (if any) for a
+ * target. */
+ virtual ExportInfo FindExportInfo(cmGeneratorTarget const* target) const = 0;
+
enum FreeTargetsReplace
{
ReplaceFreeTargets,
diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h
index 8fa3d3e..1e1a5a8 100644
--- a/Source/cmExportInstallAndroidMKGenerator.h
+++ b/Source/cmExportInstallAndroidMKGenerator.h
@@ -40,6 +40,8 @@ public:
protected:
GenerateType GetGenerateType() const override { return INSTALL; }
+ char GetConfigFileNameSeparator() const override { return '-'; }
+
// Implement virtual methods from the superclass.
void ReportDuplicateTarget(std::string const& targetName) const;
bool GenerateMainFile(std::ostream& os) override;
diff --git a/Source/cmExportInstallCMakeConfigGenerator.cxx b/Source/cmExportInstallCMakeConfigGenerator.cxx
index e2185ed..e1b2285 100644
--- a/Source/cmExportInstallCMakeConfigGenerator.cxx
+++ b/Source/cmExportInstallCMakeConfigGenerator.cxx
@@ -13,6 +13,7 @@
#include <cm/string_view>
#include <cmext/string_view>
+#include "cmExportFileGenerator.h"
#include "cmExportSet.h"
#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
@@ -224,48 +225,17 @@ void cmExportInstallCMakeConfigGenerator::LoadConfigFiles(std::ostream& os)
/* clang-format on */
}
-bool cmExportInstallCMakeConfigGenerator::GenerateImportFileConfig(
- std::string const& config)
+void cmExportInstallCMakeConfigGenerator::GenerateImportConfig(
+ std::ostream& os, std::string const& config)
{
- // Skip configurations not enabled for this export.
- if (!this->IEGen->InstallsForConfig(config)) {
- return true;
- }
-
- // Construct the name of the file to generate.
- std::string fileName = cmStrCat(this->FileDir, '/', this->FileBase, '-');
- if (!config.empty()) {
- fileName += cmSystemTools::LowerCase(config);
- } else {
- fileName += "noconfig";
- }
- fileName += this->FileExt;
-
- // Open the output file to generate it.
- cmGeneratedFileStream exportFileStream(fileName, true);
- if (!exportFileStream) {
- std::string se = cmSystemTools::GetLastSystemError();
- std::ostringstream e;
- e << "cannot write to file \"" << fileName << "\": " << se;
- cmSystemTools::Error(e.str());
- return false;
- }
- exportFileStream.SetCopyIfDifferent(true);
- std::ostream& os = exportFileStream;
-
// Start with the import file header.
this->GenerateImportHeaderCode(os, config);
// Generate the per-config target information.
- this->GenerateImportConfig(os, config);
+ this->cmExportFileGenerator::GenerateImportConfig(os, config);
// End with the import file footer.
this->GenerateImportFooterCode(os);
-
- // Record this per-config import file.
- this->ConfigImportFiles[config] = fileName;
-
- return true;
}
void cmExportInstallCMakeConfigGenerator::GenerateImportTargetsConfig(
diff --git a/Source/cmExportInstallCMakeConfigGenerator.h b/Source/cmExportInstallCMakeConfigGenerator.h
index 2ef9af0..e56836b 100644
--- a/Source/cmExportInstallCMakeConfigGenerator.h
+++ b/Source/cmExportInstallCMakeConfigGenerator.h
@@ -49,6 +49,10 @@ protected:
bool GenerateMainFile(std::ostream& os) override;
void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
std::string const& suffix) override;
+ void GenerateImportConfig(std::ostream& os,
+ std::string const& config) override;
+
+ char GetConfigFileNameSeparator() const override { return '-'; }
/** Generate the relative import prefix. */
virtual void GenerateImportPrefix(std::ostream&);
@@ -58,9 +62,6 @@ protected:
virtual void CleanupTemporaryVariables(std::ostream&);
- /** Generate a per-configuration file for the targets. */
- virtual bool GenerateImportFileConfig(std::string const& config);
-
std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
cmTargetExport const* te) override;
std::string GetFileSetFiles(cmGeneratorTarget* gte, cmFileSet* fileSet,
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 8738938..7bd754a 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -8,8 +8,10 @@
#include <memory>
#include <set>
#include <sstream>
+#include <utility>
#include "cmExportSet.h"
+#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmInstallTargetGenerator.h"
@@ -81,7 +83,8 @@ std::string cmExportInstallFileGenerator::GetImportXcFrameworkLocation(
if (!importedXcFrameworkLocation.empty()) {
importedXcFrameworkLocation = cmGeneratorExpression::Preprocess(
importedXcFrameworkLocation,
- cmGeneratorExpression::PreprocessContext::InstallInterface, true);
+ cmGeneratorExpression::PreprocessContext::InstallInterface,
+ this->GetImportPrefixWithSlash());
importedXcFrameworkLocation = cmGeneratorExpression::Evaluate(
importedXcFrameworkLocation, targetExport->Target->GetLocalGenerator(),
config, targetExport->Target, nullptr, targetExport->Target);
@@ -97,6 +100,45 @@ std::string cmExportInstallFileGenerator::GetImportXcFrameworkLocation(
return importedXcFrameworkLocation;
}
+bool cmExportInstallFileGenerator::GenerateImportFileConfig(
+ std::string const& config)
+{
+ // Skip configurations not enabled for this export.
+ if (!this->IEGen->InstallsForConfig(config)) {
+ return true;
+ }
+
+ // Construct the name of the file to generate.
+ std::string fileName = cmStrCat(this->FileDir, '/', this->FileBase,
+ this->GetConfigFileNameSeparator());
+ if (!config.empty()) {
+ fileName += cmSystemTools::LowerCase(config);
+ } else {
+ fileName += "noconfig";
+ }
+ fileName += this->FileExt;
+
+ // Open the output file to generate it.
+ cmGeneratedFileStream exportFileStream(fileName, true);
+ if (!exportFileStream) {
+ std::string se = cmSystemTools::GetLastSystemError();
+ std::ostringstream e;
+ e << "cannot write to file \"" << fileName << "\": " << se;
+ cmSystemTools::Error(e.str());
+ return false;
+ }
+ exportFileStream.SetCopyIfDifferent(true);
+ std::ostream& os = exportFileStream;
+
+ // Generate the per-config target information.
+ this->GenerateImportConfig(os, config);
+
+ // Record this per-config import file.
+ this->ConfigImportFiles[config] = fileName;
+
+ return true;
+}
+
void cmExportInstallFileGenerator::SetImportLocationProperty(
std::string const& config, std::string const& suffix,
cmInstallTargetGenerator* itgen, ImportPropertyMap& properties,
@@ -115,7 +157,7 @@ void cmExportInstallFileGenerator::SetImportLocationProperty(
std::string value;
if (!cmSystemTools::FileIsFullPath(dest)) {
// The target is installed relative to the installation prefix.
- value = "${_IMPORT_PREFIX}/";
+ value = std::string{ this->GetImportPrefixWithSlash() };
}
value += dest;
value += "/";
@@ -204,10 +246,9 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
std::string& link_libs, cmGeneratorTarget const* depender,
cmGeneratorTarget* dependee)
{
- std::string const& name = dependee->GetName();
- cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
- auto exportInfo = this->FindNamespaces(gg, name);
- std::vector<std::string> const& exportFiles = exportInfo.first;
+ auto const& exportInfo = this->FindExportInfo(dependee);
+ auto const& exportFiles = exportInfo.first;
+
if (exportFiles.size() == 1) {
std::string missingTarget = exportInfo.second;
@@ -221,26 +262,24 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
}
}
-std::pair<std::vector<std::string>, std::string>
-cmExportInstallFileGenerator::FindNamespaces(cmGlobalGenerator* gg,
- std::string const& name) const
+cmExportFileGenerator::ExportInfo cmExportInstallFileGenerator::FindExportInfo(
+ cmGeneratorTarget const* target) const
{
std::vector<std::string> exportFiles;
std::string ns;
- cmExportSetMap const& exportSets = gg->GetExportSets();
- for (auto const& expIt : exportSets) {
- cmExportSet const& exportSet = expIt.second;
+ auto const& name = target->GetName();
+ auto& exportSets =
+ target->GetLocalGenerator()->GetGlobalGenerator()->GetExportSets();
- bool containsTarget = false;
- for (auto const& target : exportSet.GetTargetExports()) {
- if (name == target->TargetName) {
- containsTarget = true;
- break;
- }
- }
+ for (auto const& exp : exportSets) {
+ auto const& exportSet = exp.second;
+ auto const& targets = exportSet.GetTargetExports();
- if (containsTarget) {
+ if (std::any_of(targets.begin(), targets.end(),
+ [&name](std::unique_ptr<cmTargetExport> const& te) {
+ return te->TargetName == name;
+ })) {
std::vector<cmInstallExportGenerator const*> const* installs =
exportSet.GetInstallations();
for (cmInstallExportGenerator const* install : *installs) {
@@ -250,7 +289,7 @@ cmExportInstallFileGenerator::FindNamespaces(cmGlobalGenerator* gg,
}
}
- return { exportFiles, ns };
+ return { exportFiles, exportFiles.size() == 1 ? ns : std::string{} };
}
void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
@@ -361,10 +400,11 @@ bool isSubDirectory(std::string const& a, std::string const& b)
return (cmSystemTools::ComparePath(a, b) ||
cmSystemTools::IsSubDirectory(a, b));
}
+}
-bool checkInterfaceDirs(std::string const& prepro,
- cmGeneratorTarget const* target,
- std::string const& prop)
+bool cmExportInstallFileGenerator::CheckInterfaceDirs(
+ std::string const& prepro, cmGeneratorTarget const* target,
+ std::string const& prop) const
{
std::string const& installDir =
target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
@@ -385,7 +425,7 @@ bool checkInterfaceDirs(std::string const& prepro,
if (genexPos == 0) {
continue;
}
- if (cmHasLiteralPrefix(li, "${_IMPORT_PREFIX}")) {
+ if (cmHasPrefix(li, this->GetImportPrefixWithSlash())) {
continue;
}
MessageType messageType = MessageType::FATAL_ERROR;
@@ -483,7 +523,6 @@ bool checkInterfaceDirs(std::string const& prepro,
}
return !hadFatalError;
}
-}
void cmExportInstallFileGenerator::PopulateSourcesInterface(
cmGeneratorTarget const* gt,
@@ -504,12 +543,12 @@ void cmExportInstallFileGenerator::PopulateSourcesInterface(
return;
}
- std::string prepro =
- cmGeneratorExpression::Preprocess(*input, preprocessRule, true);
+ std::string prepro = cmGeneratorExpression::Preprocess(
+ *input, preprocessRule, this->GetImportPrefixWithSlash());
if (!prepro.empty()) {
this->ResolveTargetsInGeneratorExpressions(prepro, gt);
- if (!checkInterfaceDirs(prepro, gt, propName)) {
+ if (!this->CheckInterfaceDirs(prepro, gt, propName)) {
return;
}
properties[propName] = prepro;
@@ -533,7 +572,7 @@ void cmExportInstallFileGenerator::PopulateIncludeDirectoriesInterface(
std::string dirs = cmGeneratorExpression::Preprocess(
cmList::to_string(target->Target->GetInstallIncludeDirectoriesEntries(te)),
- preprocessRule, true);
+ preprocessRule, this->GetImportPrefixWithSlash());
this->ReplaceInstallPrefix(dirs);
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
std::string exportDirs =
@@ -567,12 +606,12 @@ void cmExportInstallFileGenerator::PopulateIncludeDirectoriesInterface(
std::string includes = (input ? *input : "");
char const* const sep = input ? ";" : "";
includes += sep + exportDirs;
- std::string prepro =
- cmGeneratorExpression::Preprocess(includes, preprocessRule, true);
+ std::string prepro = cmGeneratorExpression::Preprocess(
+ includes, preprocessRule, this->GetImportPrefixWithSlash());
if (!prepro.empty()) {
this->ResolveTargetsInGeneratorExpressions(prepro, target);
- if (!checkInterfaceDirs(prepro, target, propName)) {
+ if (!this->CheckInterfaceDirs(prepro, target, propName)) {
return;
}
properties[propName] = prepro;
@@ -598,12 +637,12 @@ void cmExportInstallFileGenerator::PopulateLinkDependsInterface(
return;
}
- std::string prepro =
- cmGeneratorExpression::Preprocess(*input, preprocessRule, true);
+ std::string prepro = cmGeneratorExpression::Preprocess(
+ *input, preprocessRule, this->GetImportPrefixWithSlash());
if (!prepro.empty()) {
this->ResolveTargetsInGeneratorExpressions(prepro, gt);
- if (!checkInterfaceDirs(prepro, gt, propName)) {
+ if (!this->CheckInterfaceDirs(prepro, gt, propName)) {
return;
}
properties[propName] = prepro;
@@ -629,12 +668,12 @@ void cmExportInstallFileGenerator::PopulateLinkDirectoriesInterface(
return;
}
- std::string prepro =
- cmGeneratorExpression::Preprocess(*input, preprocessRule, true);
+ std::string prepro = cmGeneratorExpression::Preprocess(
+ *input, preprocessRule, this->GetImportPrefixWithSlash());
if (!prepro.empty()) {
this->ResolveTargetsInGeneratorExpressions(prepro, gt);
- if (!checkInterfaceDirs(prepro, gt, propName)) {
+ if (!this->CheckInterfaceDirs(prepro, gt, propName)) {
return;
}
properties[propName] = prepro;
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 24cda9d..f33ecc1 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -8,7 +8,6 @@
#include <map>
#include <set>
#include <string>
-#include <utility>
#include <vector>
#include <cm/string_view>
@@ -20,7 +19,6 @@
class cmExportSet;
class cmGeneratorTarget;
-class cmGlobalGenerator;
class cmInstallTargetGenerator;
class cmTargetExport;
@@ -80,6 +78,7 @@ protected:
cm::string_view const& prefixWithSlash = this->GetImportPrefixWithSlash();
return std::string(prefixWithSlash.data(), prefixWithSlash.length() - 1);
}
+ virtual char GetConfigFileNameSeparator() const = 0;
void HandleMissingTarget(std::string& link_libs,
cmGeneratorTarget const* depender,
@@ -94,11 +93,13 @@ protected:
void ComplainAboutDuplicateTarget(
std::string const& targetName) const override;
- std::pair<std::vector<std::string>, std::string> FindNamespaces(
- cmGlobalGenerator* gg, std::string const& name) const;
+ ExportInfo FindExportInfo(cmGeneratorTarget const* target) const override;
void ReportError(std::string const& errorMessage) const override;
+ /** Generate a per-configuration file for the targets. */
+ virtual bool GenerateImportFileConfig(std::string const& config);
+
/** Fill in properties indicating installed file locations. */
void SetImportLocationProperty(std::string const& config,
std::string const& suffix,
@@ -144,6 +145,9 @@ protected:
std::map<std::string, std::vector<std::string>> ConfigCxxModuleTargetFiles;
private:
+ bool CheckInterfaceDirs(std::string const& prepro,
+ cmGeneratorTarget const* target,
+ std::string const& prop) const;
void PopulateCompatibleInterfaceProperties(cmGeneratorTarget const* target,
ImportPropertyMap& properties);
void PopulateCustomTransitiveInterfaceProperties(
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 4b290e6..58d1f5e 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -45,6 +45,11 @@ protected:
{
}
+ ExportInfo FindExportInfo(cmGeneratorTarget const* /*target*/) const override
+ {
+ return { {}, {} };
+ }
+
void PopulateProperties(cmGeneratorTarget const* target,
ImportPropertyMap& properties,
std::set<cmGeneratorTarget const*>& emitted);
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 8e590fa..deb292d 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -7,6 +7,8 @@
#include <memory>
#include <utility>
+#include <cm/string_view>
+
#include "cmsys/RegularExpression.hxx"
#include "cmGeneratorExpressionContext.h"
@@ -193,7 +195,7 @@ static std::string stripAllGeneratorExpressions(const std::string& input)
}
static void prefixItems(const std::string& content, std::string& result,
- const std::string& prefix)
+ const cm::string_view& prefix)
{
std::vector<std::string> entries;
cmGeneratorExpression::Split(content, entries);
@@ -211,7 +213,7 @@ static void prefixItems(const std::string& content, std::string& result,
static std::string stripExportInterface(
const std::string& input, cmGeneratorExpression::PreprocessContext context,
- bool resolveRelative)
+ cm::string_view importPrefix)
{
std::string result;
@@ -268,8 +270,8 @@ static std::string stripExportInterface(
} else if (context == cmGeneratorExpression::InstallInterface &&
foundGenex == FoundGenex::InstallInterface) {
const std::string content = input.substr(pos, c - cStart);
- if (resolveRelative) {
- prefixItems(content, result, "${_IMPORT_PREFIX}/");
+ if (!importPrefix.empty()) {
+ prefixItems(content, result, importPrefix);
} else {
result += content;
}
@@ -359,13 +361,13 @@ void cmGeneratorExpression::Split(const std::string& input,
std::string cmGeneratorExpression::Preprocess(const std::string& input,
PreprocessContext context,
- bool resolveRelative)
+ cm::string_view importPrefix)
{
if (context == StripAllGeneratorExpressions) {
return stripAllGeneratorExpressions(input);
}
if (context == BuildInterface || context == InstallInterface) {
- return stripExportInterface(input, context, resolveRelative);
+ return stripExportInterface(input, context, importPrefix);
}
assert(false &&
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 71855c9..0abd968 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -11,6 +11,8 @@
#include <utility>
#include <vector>
+#include <cm/string_view>
+
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
@@ -59,7 +61,7 @@ public:
static std::string Preprocess(const std::string& input,
PreprocessContext context,
- bool resolveRelative = false);
+ cm::string_view importPrefix = {});
static void Split(const std::string& input,
std::vector<std::string>& output);