mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-06 07:40:53 +00:00
cmInstallFileSetGenerator: Only support per config Destination.
This commit is contained in:
@@ -284,23 +284,20 @@ std::string cmExportInstallCMakeConfigGenerator::GetFileSetDirectories(
|
||||
auto configs =
|
||||
gte->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
cmGeneratorExpression ge(*gte->Makefile->GetCMakeInstance());
|
||||
auto cge =
|
||||
ge.Parse(te->FileSetGenerators.at(fileSet->GetName())->GetDestination());
|
||||
|
||||
for (auto const& config : configs) {
|
||||
auto unescapedDest = cge->Evaluate(gte->LocalGenerator, config, gte);
|
||||
auto result = te->FileSetGenerators.at(fileSet->GetName())
|
||||
->GetDestination(gte, config);
|
||||
|
||||
auto dest = cmOutputConverter::EscapeForCMake(
|
||||
unescapedDest, cmOutputConverter::WrapQuotes::NoWrap);
|
||||
if (!cmSystemTools::FileIsFullPath(unescapedDest)) {
|
||||
result.unescapedDestination, cmOutputConverter::WrapQuotes::NoWrap);
|
||||
if (!cmSystemTools::FileIsFullPath(result.unescapedDestination)) {
|
||||
dest = cmStrCat("${_IMPORT_PREFIX}/", dest);
|
||||
}
|
||||
|
||||
auto const& type = fileSet->GetType();
|
||||
// C++ modules do not support interface file sets which are dependent upon
|
||||
// the configuration.
|
||||
if (cge->GetHadContextSensitiveCondition() &&
|
||||
type == cm::FileSetMetadata::CXX_MODULES) {
|
||||
if (result.isConfigDependent && type == cm::FileSetMetadata::CXX_MODULES) {
|
||||
auto* mf = this->IEGen->GetLocalGenerator()->GetMakefile();
|
||||
std::ostringstream e;
|
||||
e << "The \"" << gte->GetName() << "\" target's interface file set \""
|
||||
@@ -311,7 +308,7 @@ std::string cmExportInstallCMakeConfigGenerator::GetFileSetDirectories(
|
||||
return std::string{};
|
||||
}
|
||||
|
||||
if (cge->GetHadContextSensitiveCondition() && configs.size() != 1) {
|
||||
if (result.isConfigDependent && configs.size() != 1) {
|
||||
resultVector.push_back(
|
||||
cmStrCat("\"$<$<CONFIG:", config, ">:", dest, ">\""));
|
||||
} else {
|
||||
|
||||
@@ -224,18 +224,14 @@ cmExportInstallPackageInfoGenerator::GetFileSetDirectory(
|
||||
cmGeneratorTarget* gte, cmTargetExport const* te,
|
||||
cmGeneratorFileSet const* fileSet, cm::optional<std::string> const& config)
|
||||
{
|
||||
cmGeneratorExpression ge(*gte->Makefile->GetCMakeInstance());
|
||||
auto cge =
|
||||
ge.Parse(te->FileSetGenerators.at(fileSet->GetName())->GetDestination());
|
||||
auto config_value = config.value_or("");
|
||||
auto result = te->FileSetGenerators.at(fileSet->GetName())
|
||||
->GetDestination(gte, config_value);
|
||||
|
||||
std::string const unescapedDest =
|
||||
cge->Evaluate(gte->LocalGenerator, config.value_or(""), gte);
|
||||
bool const isConfigDependent = cge->GetHadContextSensitiveCondition();
|
||||
|
||||
if (config && !isConfigDependent) {
|
||||
if (config && !result.isConfigDependent) {
|
||||
return {};
|
||||
}
|
||||
if (!config && isConfigDependent) {
|
||||
if (!config && result.isConfigDependent) {
|
||||
this->RequiresConfigFiles = true;
|
||||
return {};
|
||||
}
|
||||
@@ -255,9 +251,9 @@ cmExportInstallPackageInfoGenerator::GetFileSetDirectory(
|
||||
}
|
||||
|
||||
cm::optional<std::string> dest = cmOutputConverter::EscapeForCMake(
|
||||
unescapedDest, cmOutputConverter::WrapQuotes::NoWrap);
|
||||
result.unescapedDestination, cmOutputConverter::WrapQuotes::NoWrap);
|
||||
|
||||
if (!cmSystemTools::FileIsFullPath(unescapedDest)) {
|
||||
if (!cmSystemTools::FileIsFullPath(result.unescapedDestination)) {
|
||||
dest = cmStrCat("@prefix@/"_s, *dest);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,15 +216,11 @@ cm::optional<std::string> cmExportInstallSbomGenerator::GetFileSetDirectory(
|
||||
cmGeneratorTarget* gte, cmTargetExport const* te,
|
||||
cmGeneratorFileSet const* fileSet, cm::optional<std::string> const& config)
|
||||
{
|
||||
cmGeneratorExpression ge(*gte->Makefile->GetCMakeInstance());
|
||||
auto cge =
|
||||
ge.Parse(te->FileSetGenerators.at(fileSet->GetName())->GetDestination());
|
||||
auto config_value = config.value_or("");
|
||||
auto result = te->FileSetGenerators.at(fileSet->GetName())
|
||||
->GetDestination(gte, config_value);
|
||||
|
||||
std::string const unescapedDest =
|
||||
cge->Evaluate(gte->LocalGenerator, config.value_or(""), gte);
|
||||
bool const isConfigDependent = cge->GetHadContextSensitiveCondition();
|
||||
|
||||
if (config && !isConfigDependent) {
|
||||
if (config && !result.isConfigDependent) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -241,9 +237,9 @@ cm::optional<std::string> cmExportInstallSbomGenerator::GetFileSetDirectory(
|
||||
}
|
||||
|
||||
cm::optional<std::string> dest = cmOutputConverter::EscapeForCMake(
|
||||
unescapedDest, cmOutputConverter::WrapQuotes::NoWrap);
|
||||
result.unescapedDestination, cmOutputConverter::WrapQuotes::NoWrap);
|
||||
|
||||
if (!cmSystemTools::FileIsFullPath(unescapedDest)) {
|
||||
if (!cmSystemTools::FileIsFullPath(result.unescapedDestination)) {
|
||||
dest = cmStrCat("@prefix@/"_s, *dest);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmTarget.h"
|
||||
@@ -91,11 +92,26 @@ bool cmInstallFileSetGenerator::Compute(cmLocalGenerator* lg)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string cmInstallFileSetGenerator::GetDestination() const
|
||||
{
|
||||
return this->Destination;
|
||||
}
|
||||
|
||||
std::string cmInstallFileSetGenerator::GetDestination(
|
||||
std::string const& config) const
|
||||
{
|
||||
return cmGeneratorExpression::Evaluate(this->Destination,
|
||||
this->LocalGenerator, config);
|
||||
return this->GetDestination(this->Target, config).unescapedDestination;
|
||||
}
|
||||
|
||||
cmInstallFileSetGenerator::DestinationContext
|
||||
cmInstallFileSetGenerator::GetDestination(cmGeneratorTarget* gte,
|
||||
std::string const& config) const
|
||||
{
|
||||
cmGeneratorExpression ge(*gte->Makefile->GetCMakeInstance());
|
||||
auto cge = ge.Parse(this->Destination);
|
||||
|
||||
std::string const dest = cge->Evaluate(gte->LocalGenerator, config, gte);
|
||||
return { dest, cge->GetHadContextSensitiveCondition() };
|
||||
}
|
||||
|
||||
void cmInstallFileSetGenerator::GenerateScriptForConfig(
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#include "cmInstallGenerator.h"
|
||||
|
||||
class cmGeneratorTarget;
|
||||
class cmExportInstallCMakeConfigGenerator;
|
||||
class cmGeneratorFileSet;
|
||||
class cmGeneratorTarget;
|
||||
class cmListFileBacktrace;
|
||||
class cmLocalGenerator;
|
||||
|
||||
@@ -28,14 +29,23 @@ public:
|
||||
|
||||
bool Compute(cmLocalGenerator* lg) override;
|
||||
|
||||
struct DestinationContext
|
||||
{
|
||||
std::string unescapedDestination;
|
||||
bool isConfigDependent;
|
||||
};
|
||||
std::string GetDestination(std::string const& config) const;
|
||||
std::string GetDestination() const { return this->Destination; }
|
||||
DestinationContext GetDestination(cmGeneratorTarget* gt,
|
||||
std::string const& config) const;
|
||||
bool GetOptional() const { return this->Optional; }
|
||||
std::string GetFileSetName() const { return this->FileSetName; }
|
||||
cmGeneratorFileSet const* GetFileSet() const { return this->FileSet; };
|
||||
cmGeneratorTarget* GetTarget() const { return this->Target; }
|
||||
|
||||
protected:
|
||||
friend cmExportInstallCMakeConfigGenerator;
|
||||
std::string GetDestination() const;
|
||||
|
||||
void GenerateScriptForConfig(std::ostream& os, std::string const& config,
|
||||
Indent indent) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user