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