mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-18 08:51:52 +08:00
Merge branch 'backport-3.31-custom-transitive-properties'
This commit is contained in:
@@ -627,13 +627,13 @@ cmComputeLinkDepends::cmComputeLinkDepends(cmGeneratorTarget const* target,
|
|||||||
if (!feature->empty() && key.length() > lloPrefix.length()) {
|
if (!feature->empty() && key.length() > lloPrefix.length()) {
|
||||||
auto item = key.substr(lloPrefix.length());
|
auto item = key.substr(lloPrefix.length());
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
this->Target->GetBacktrace(),
|
|
||||||
this->Target,
|
this->Target,
|
||||||
"LINK_LIBRARY_OVERRIDE",
|
"LINK_LIBRARY_OVERRIDE",
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
this->Target->GetLocalGenerator(),
|
this->Target->GetLocalGenerator(),
|
||||||
config,
|
config,
|
||||||
|
this->Target->GetBacktrace(),
|
||||||
};
|
};
|
||||||
auto overrideFeature = cmGeneratorExpression::Evaluate(
|
auto overrideFeature = cmGeneratorExpression::Evaluate(
|
||||||
*feature, this->Target->GetLocalGenerator(), config,
|
*feature, this->Target->GetLocalGenerator(), config,
|
||||||
@@ -647,13 +647,13 @@ cmComputeLinkDepends::cmComputeLinkDepends(cmGeneratorTarget const* target,
|
|||||||
if (cmValue linkLibraryOverride =
|
if (cmValue linkLibraryOverride =
|
||||||
this->Target->GetProperty("LINK_LIBRARY_OVERRIDE")) {
|
this->Target->GetProperty("LINK_LIBRARY_OVERRIDE")) {
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
target->GetBacktrace(),
|
|
||||||
target,
|
target,
|
||||||
"LINK_LIBRARY_OVERRIDE",
|
"LINK_LIBRARY_OVERRIDE",
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
target->GetLocalGenerator(),
|
target->GetLocalGenerator(),
|
||||||
config,
|
config,
|
||||||
|
target->GetBacktrace(),
|
||||||
};
|
};
|
||||||
auto overrideValue = cmGeneratorExpression::Evaluate(
|
auto overrideValue = cmGeneratorExpression::Evaluate(
|
||||||
*linkLibraryOverride, target->GetLocalGenerator(), config, target,
|
*linkLibraryOverride, target->GetLocalGenerator(), config, target,
|
||||||
|
@@ -21,32 +21,22 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
|||||||
cmGeneratorTarget const* target, std::string property,
|
cmGeneratorTarget const* target, std::string property,
|
||||||
GeneratorExpressionContent const* content,
|
GeneratorExpressionContent const* content,
|
||||||
cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
|
cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
|
||||||
std::string const& contextConfig)
|
std::string const& contextConfig, cmListFileBacktrace backtrace,
|
||||||
: cmGeneratorExpressionDAGChecker(cmListFileBacktrace(), target,
|
ComputingLinkLibraries computingLinkLibraries)
|
||||||
std::move(property), content, parent,
|
|
||||||
contextLG, contextConfig)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
|
||||||
cmListFileBacktrace backtrace, cmGeneratorTarget const* target,
|
|
||||||
std::string property, GeneratorExpressionContent const* content,
|
|
||||||
cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
|
|
||||||
std::string const& contextConfig)
|
|
||||||
: Parent(parent)
|
: Parent(parent)
|
||||||
, Top(parent ? parent->Top : this)
|
, Top(parent ? parent->Top : this)
|
||||||
, Target(target)
|
, Target(target)
|
||||||
, Property(std::move(property))
|
, Property(std::move(property))
|
||||||
, Content(content)
|
, Content(content)
|
||||||
, Backtrace(std::move(backtrace))
|
, Backtrace(std::move(backtrace))
|
||||||
|
, ComputingLinkLibraries_(computingLinkLibraries)
|
||||||
{
|
{
|
||||||
if (parent) {
|
if (parent) {
|
||||||
this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty;
|
this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty;
|
||||||
} else {
|
} else {
|
||||||
this->TopIsTransitiveProperty =
|
this->TopIsTransitiveProperty =
|
||||||
this->Target
|
this->Target
|
||||||
->IsTransitiveProperty(this->Property, contextLG, contextConfig,
|
->IsTransitiveProperty(this->Property, contextLG, contextConfig, this)
|
||||||
this->EvaluatingLinkLibraries())
|
|
||||||
.has_value();
|
.has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +194,11 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkerLauncher() const
|
|||||||
"_LINKER_LAUNCHER"_s;
|
"_LINKER_LAUNCHER"_s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmGeneratorExpressionDAGChecker::IsComputingLinkLibraries() const
|
||||||
|
{
|
||||||
|
return this->Top->ComputingLinkLibraries_ == ComputingLinkLibraries::Yes;
|
||||||
|
}
|
||||||
|
|
||||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
|
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
|
||||||
cmGeneratorTarget const* tgt, ForGenex genex) const
|
cmGeneratorTarget const* tgt, ForGenex genex) const
|
||||||
{
|
{
|
||||||
|
@@ -17,19 +17,19 @@ class cmLocalGenerator;
|
|||||||
|
|
||||||
struct cmGeneratorExpressionDAGChecker
|
struct cmGeneratorExpressionDAGChecker
|
||||||
{
|
{
|
||||||
cmGeneratorExpressionDAGChecker(cmListFileBacktrace backtrace,
|
enum class ComputingLinkLibraries
|
||||||
cmGeneratorTarget const* target,
|
{
|
||||||
std::string property,
|
No,
|
||||||
|
Yes,
|
||||||
|
};
|
||||||
|
cmGeneratorExpressionDAGChecker(
|
||||||
|
cmGeneratorTarget const* target, std::string property,
|
||||||
GeneratorExpressionContent const* content,
|
GeneratorExpressionContent const* content,
|
||||||
cmGeneratorExpressionDAGChecker* parent,
|
cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
|
||||||
cmLocalGenerator const* contextLG,
|
std::string const& contextConfig,
|
||||||
std::string const& contextConfig);
|
cmListFileBacktrace backtrace = cmListFileBacktrace(),
|
||||||
cmGeneratorExpressionDAGChecker(cmGeneratorTarget const* target,
|
ComputingLinkLibraries computingLinkLibraries =
|
||||||
std::string property,
|
ComputingLinkLibraries::No);
|
||||||
GeneratorExpressionContent const* content,
|
|
||||||
cmGeneratorExpressionDAGChecker* parent,
|
|
||||||
cmLocalGenerator const* contextLG,
|
|
||||||
std::string const& contextConfig);
|
|
||||||
|
|
||||||
enum Result
|
enum Result
|
||||||
{
|
{
|
||||||
@@ -52,6 +52,11 @@ struct cmGeneratorExpressionDAGChecker
|
|||||||
bool EvaluatingLinkOptionsExpression() const;
|
bool EvaluatingLinkOptionsExpression() const;
|
||||||
bool EvaluatingLinkerLauncher() const;
|
bool EvaluatingLinkerLauncher() const;
|
||||||
|
|
||||||
|
/** Returns true only when computing the actual link dependency
|
||||||
|
graph for cmGeneratorTarget::GetLinkImplementationLibraries
|
||||||
|
or cmGeneratorTarget::GetLinkInterfaceLibraries. */
|
||||||
|
bool IsComputingLinkLibraries() const;
|
||||||
|
|
||||||
enum class ForGenex
|
enum class ForGenex
|
||||||
{
|
{
|
||||||
ANY,
|
ANY,
|
||||||
@@ -85,4 +90,6 @@ private:
|
|||||||
bool TransitivePropertiesOnly = false;
|
bool TransitivePropertiesOnly = false;
|
||||||
bool CMP0131 = false;
|
bool CMP0131 = false;
|
||||||
bool TopIsTransitiveProperty = false;
|
bool TopIsTransitiveProperty = false;
|
||||||
|
ComputingLinkLibraries const ComputingLinkLibraries_ =
|
||||||
|
ComputingLinkLibraries::No;
|
||||||
};
|
};
|
||||||
|
@@ -484,13 +484,13 @@ protected:
|
|||||||
{
|
{
|
||||||
if (context->HeadTarget) {
|
if (context->HeadTarget) {
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
context->Backtrace,
|
|
||||||
context->HeadTarget,
|
context->HeadTarget,
|
||||||
genexOperator + ":" + expression,
|
genexOperator + ":" + expression,
|
||||||
content,
|
content,
|
||||||
dagCheckerParent,
|
dagCheckerParent,
|
||||||
context->LG,
|
context->LG,
|
||||||
context->Config,
|
context->Config,
|
||||||
|
context->Backtrace,
|
||||||
};
|
};
|
||||||
switch (dagChecker.Check()) {
|
switch (dagChecker.Check()) {
|
||||||
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
||||||
@@ -2957,8 +2957,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
|||||||
|
|
||||||
if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
|
if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
|
||||||
target->IsTransitiveProperty(propertyName, context->LG,
|
target->IsTransitiveProperty(propertyName, context->LG,
|
||||||
context->Config,
|
context->Config, dagCheckerParent)) {
|
||||||
evaluatingLinkLibraries)) {
|
|
||||||
interfacePropertyName = std::string(transitiveProp->InterfaceName);
|
interfacePropertyName = std::string(transitiveProp->InterfaceName);
|
||||||
isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
|
isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
|
||||||
usage = transitiveProp->Usage;
|
usage = transitiveProp->Usage;
|
||||||
@@ -2993,8 +2992,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
context->Backtrace, target, propertyName, content,
|
target,
|
||||||
dagCheckerParent, context->LG, context->Config,
|
propertyName,
|
||||||
|
content,
|
||||||
|
dagCheckerParent,
|
||||||
|
context->LG,
|
||||||
|
context->Config,
|
||||||
|
context->Backtrace,
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (dagChecker.Check()) {
|
switch (dagChecker.Check()) {
|
||||||
|
@@ -1006,7 +1006,8 @@ public:
|
|||||||
|
|
||||||
cm::optional<TransitiveProperty> IsTransitiveProperty(
|
cm::optional<TransitiveProperty> IsTransitiveProperty(
|
||||||
cm::string_view prop, cmLocalGenerator const* lg,
|
cm::string_view prop, cmLocalGenerator const* lg,
|
||||||
std::string const& config, bool evaluatingLinkLibraries) const;
|
std::string const& config,
|
||||||
|
cmGeneratorExpressionDAGChecker const* dagChecker) const;
|
||||||
|
|
||||||
bool HaveInstallTreeRPATH(std::string const& config) const;
|
bool HaveInstallTreeRPATH(std::string const& config) const;
|
||||||
|
|
||||||
|
@@ -47,8 +47,13 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
|
|||||||
cmGeneratorExpressionDAGChecker* context)
|
cmGeneratorExpressionDAGChecker* context)
|
||||||
{
|
{
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
target->GetBacktrace(), target, propertyName, nullptr, context,
|
target,
|
||||||
target->GetLocalGenerator(), config,
|
propertyName,
|
||||||
|
nullptr,
|
||||||
|
context,
|
||||||
|
target->GetLocalGenerator(),
|
||||||
|
config,
|
||||||
|
target->GetBacktrace(),
|
||||||
};
|
};
|
||||||
switch (dagChecker.Check()) {
|
switch (dagChecker.Check()) {
|
||||||
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
||||||
@@ -100,8 +105,13 @@ void AddLangSpecificImplicitIncludeDirectories(
|
|||||||
if (auto const* libraries =
|
if (auto const* libraries =
|
||||||
target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
|
target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
target->GetBacktrace(), target, propertyName, nullptr, nullptr,
|
target,
|
||||||
target->GetLocalGenerator(), config,
|
propertyName,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
target->GetLocalGenerator(),
|
||||||
|
config,
|
||||||
|
target->GetBacktrace(),
|
||||||
};
|
};
|
||||||
|
|
||||||
for (cmLinkImplItem const& library : libraries->Libraries) {
|
for (cmLinkImplItem const& library : libraries->Libraries) {
|
||||||
|
@@ -543,7 +543,14 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
|
|||||||
}
|
}
|
||||||
// Keep this logic in sync with ComputeLinkImplementationLibraries.
|
// Keep this logic in sync with ComputeLinkImplementationLibraries.
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
this, prop, nullptr, nullptr, this->LocalGenerator, config,
|
this,
|
||||||
|
prop,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
this->LocalGenerator,
|
||||||
|
config,
|
||||||
|
cmListFileBacktrace(),
|
||||||
|
cmGeneratorExpressionDAGChecker::ComputingLinkLibraries::Yes,
|
||||||
};
|
};
|
||||||
// The $<LINK_ONLY> expression may be in a link interface to specify
|
// The $<LINK_ONLY> expression may be in a link interface to specify
|
||||||
// private link dependencies that are otherwise excluded from usage
|
// private link dependencies that are otherwise excluded from usage
|
||||||
@@ -1135,7 +1142,14 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
|||||||
for (auto const& entry : entryRange) {
|
for (auto const& entry : entryRange) {
|
||||||
// Keep this logic in sync with ExpandLinkItems.
|
// Keep this logic in sync with ExpandLinkItems.
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
this, "LINK_LIBRARIES", nullptr, nullptr, this->LocalGenerator, config,
|
this,
|
||||||
|
"LINK_LIBRARIES",
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
this->LocalGenerator,
|
||||||
|
config,
|
||||||
|
cmListFileBacktrace(),
|
||||||
|
cmGeneratorExpressionDAGChecker::ComputingLinkLibraries::Yes,
|
||||||
};
|
};
|
||||||
// The $<LINK_ONLY> expression may be used to specify link dependencies
|
// The $<LINK_ONLY> expression may be used to specify link dependencies
|
||||||
// that are otherwise excluded from usage requirements.
|
// that are otherwise excluded from usage requirements.
|
||||||
|
@@ -110,13 +110,13 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
|
|||||||
// a subset of TargetPropertyNode::Evaluate without stringify/parse steps
|
// a subset of TargetPropertyNode::Evaluate without stringify/parse steps
|
||||||
// but sufficient for transitive interface properties.
|
// but sufficient for transitive interface properties.
|
||||||
cmGeneratorExpressionDAGChecker dagChecker{
|
cmGeneratorExpressionDAGChecker dagChecker{
|
||||||
context->Backtrace,
|
|
||||||
this,
|
this,
|
||||||
prop,
|
prop,
|
||||||
nullptr,
|
nullptr,
|
||||||
dagCheckerParent,
|
dagCheckerParent,
|
||||||
this->LocalGenerator,
|
context->LG,
|
||||||
context->Config,
|
context->Config,
|
||||||
|
context->Backtrace,
|
||||||
};
|
};
|
||||||
switch (dagChecker.Check()) {
|
switch (dagChecker.Check()) {
|
||||||
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
||||||
@@ -183,10 +183,9 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
|
|||||||
}
|
}
|
||||||
|
|
||||||
cm::optional<cmGeneratorTarget::TransitiveProperty>
|
cm::optional<cmGeneratorTarget::TransitiveProperty>
|
||||||
cmGeneratorTarget::IsTransitiveProperty(cm::string_view prop,
|
cmGeneratorTarget::IsTransitiveProperty(
|
||||||
cmLocalGenerator const* lg,
|
cm::string_view prop, cmLocalGenerator const* lg, std::string const& config,
|
||||||
std::string const& config,
|
cmGeneratorExpressionDAGChecker const* dagChecker) const
|
||||||
bool evaluatingLinkLibraries) const
|
|
||||||
{
|
{
|
||||||
cm::optional<TransitiveProperty> result;
|
cm::optional<TransitiveProperty> result;
|
||||||
static cm::string_view const kINTERFACE_ = "INTERFACE_"_s;
|
static cm::string_view const kINTERFACE_ = "INTERFACE_"_s;
|
||||||
@@ -208,7 +207,7 @@ cmGeneratorTarget::IsTransitiveProperty(cm::string_view prop,
|
|||||||
result->Usage = cmGeneratorTarget::UseTo::Compile;
|
result->Usage = cmGeneratorTarget::UseTo::Compile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!evaluatingLinkLibraries) {
|
} else if (!dagChecker || !dagChecker->IsComputingLinkLibraries()) {
|
||||||
// Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES
|
// Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES
|
||||||
// from the link closure when we are not evaluating the closure itself.
|
// from the link closure when we are not evaluating the closure itself.
|
||||||
CustomTransitiveProperties const& ctp =
|
CustomTransitiveProperties const& ctp =
|
||||||
|
@@ -90,9 +90,22 @@ target_compile_definitions(CustomTransitiveProperties PRIVATE
|
|||||||
$<TARGET_PROPERTY:CUSTOM_W>
|
$<TARGET_PROPERTY:CUSTOM_W>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Test TRANSITIVE_LINK_PROPERTIES containing LINK_LIBRARIES itself.
|
||||||
|
add_library(iface10 INTERFACE)
|
||||||
|
set_property(TARGET iface10 PROPERTY TRANSITIVE_LINK_PROPERTIES "LINK_LIBRARIES")
|
||||||
|
add_library(iface11 INTERFACE)
|
||||||
|
target_link_libraries(iface11 INTERFACE iface10)
|
||||||
|
add_library(static10 STATIC static10.c)
|
||||||
|
target_link_libraries(static10 PRIVATE iface11)
|
||||||
|
add_library(static11 STATIC static11.c)
|
||||||
|
target_link_libraries(static11 PRIVATE static10 iface11)
|
||||||
|
add_executable(main10 main10.c)
|
||||||
|
target_link_libraries(main10 PRIVATE static11 static10)
|
||||||
|
|
||||||
# Test TRANSITIVE_*_PROPERTY evaluation outside of usage requirements.
|
# Test TRANSITIVE_*_PROPERTY evaluation outside of usage requirements.
|
||||||
|
add_executable(check-args check-args.c)
|
||||||
set(out "${CMAKE_CURRENT_BINARY_DIR}/out-$<CONFIG>.txt")
|
set(out "${CMAKE_CURRENT_BINARY_DIR}/out-$<CONFIG>.txt")
|
||||||
file(GENERATE OUTPUT "${out}" CONTENT "# file(GENERATE) produced:
|
set(in_CUSTOM [====[
|
||||||
iface1 CUSTOM_A: '$<TARGET_PROPERTY:iface1,CUSTOM_A>'
|
iface1 CUSTOM_A: '$<TARGET_PROPERTY:iface1,CUSTOM_A>'
|
||||||
iface1 INTERFACE_CUSTOM_A: '$<TARGET_PROPERTY:iface1,INTERFACE_CUSTOM_A>'
|
iface1 INTERFACE_CUSTOM_A: '$<TARGET_PROPERTY:iface1,INTERFACE_CUSTOM_A>'
|
||||||
iface2 CUSTOM_A: '$<TARGET_PROPERTY:iface2,CUSTOM_A>'
|
iface2 CUSTOM_A: '$<TARGET_PROPERTY:iface2,CUSTOM_A>'
|
||||||
@@ -125,10 +138,35 @@ main CUSTOM_V: '$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_V>'
|
|||||||
main INTERFACE_CUSTOM_V: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_CUSTOM_V>'
|
main INTERFACE_CUSTOM_V: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_CUSTOM_V>'
|
||||||
main CUSTOM_W: '$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_W>'
|
main CUSTOM_W: '$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_W>'
|
||||||
main INTERFACE_CUSTOM_W: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_CUSTOM_W>'
|
main INTERFACE_CUSTOM_W: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_CUSTOM_W>'
|
||||||
|
]====])
|
||||||
|
set(in_LINK_LIBRARIES [====[
|
||||||
|
iface1 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface1,LINK_LIBRARIES>'
|
||||||
|
iface1 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface1,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
iface2 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface2,LINK_LIBRARIES>'
|
||||||
|
iface2 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface2,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
static1 LINK_LIBRARIES: '$<TARGET_PROPERTY:static1,LINK_LIBRARIES>'
|
||||||
|
static1 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:static1,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
main LINK_LIBRARIES: '$<TARGET_PROPERTY:CustomTransitiveProperties,LINK_LIBRARIES>'
|
||||||
|
main INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
iface10 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface10,LINK_LIBRARIES>'
|
||||||
|
iface10 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface10,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
iface11 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface11,LINK_LIBRARIES>'
|
||||||
|
iface11 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface11,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
static10 LINK_LIBRARIES: '$<TARGET_PROPERTY:static10,LINK_LIBRARIES>'
|
||||||
|
static10 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:static10,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
static11 LINK_LIBRARIES: '$<TARGET_PROPERTY:static11,LINK_LIBRARIES>'
|
||||||
|
static11 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:static11,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
main10 LINK_LIBRARIES: '$<TARGET_PROPERTY:main10,LINK_LIBRARIES>'
|
||||||
|
main10 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:main10,INTERFACE_LINK_LIBRARIES>'
|
||||||
|
]====])
|
||||||
|
file(GENERATE OUTPUT "${out}" CONTENT "# file(GENERATE) produced:
|
||||||
|
${in_CUSTOM}
|
||||||
|
${in_LINK_LIBRARIES}
|
||||||
")
|
")
|
||||||
add_custom_target(check ALL VERBATIM
|
add_custom_target(check ALL VERBATIM
|
||||||
COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIG> -Dout=${out} -P${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
|
COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIG> -Dout=${out} -P${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
|
||||||
COMMAND CustomTransitiveProperties
|
COMMAND CustomTransitiveProperties
|
||||||
|
COMMAND check-args
|
||||||
"$<TARGET_PROPERTY:static1,CUSTOM_A>" "CUSTOM_A_STATIC1;CUSTOM_A_IFACE2;CUSTOM_A_TARGET_TYPE_STATIC_LIBRARY;CUSTOM_A_IFACE1;CUSTOM_A_TARGET_NAME_STATIC1"
|
"$<TARGET_PROPERTY:static1,CUSTOM_A>" "CUSTOM_A_STATIC1;CUSTOM_A_IFACE2;CUSTOM_A_TARGET_TYPE_STATIC_LIBRARY;CUSTOM_A_IFACE1;CUSTOM_A_TARGET_NAME_STATIC1"
|
||||||
"$<TARGET_PROPERTY:static1,CUSTOM_B>" "CUSTOM_B_STATIC1;CUSTOM_B_IFACE1"
|
"$<TARGET_PROPERTY:static1,CUSTOM_B>" "CUSTOM_B_STATIC1;CUSTOM_B_IFACE1"
|
||||||
"$<TARGET_PROPERTY:static1,CUSTOM_U>" "CUSTOM_U_STATIC1;CUSTOM_U_IFACE2;CUSTOM_U_TARGET_TYPE_STATIC_LIBRARY;CUSTOM_U_IFACE1;CUSTOM_U_TARGET_NAME_STATIC1"
|
"$<TARGET_PROPERTY:static1,CUSTOM_U>" "CUSTOM_U_STATIC1;CUSTOM_U_IFACE2;CUSTOM_U_TARGET_TYPE_STATIC_LIBRARY;CUSTOM_U_IFACE1;CUSTOM_U_TARGET_NAME_STATIC1"
|
||||||
@@ -143,4 +181,33 @@ add_custom_target(check ALL VERBATIM
|
|||||||
"$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_U>" "CUSTOM_U_MAIN;CUSTOM_U_STATIC1_IFACE;CUSTOM_U_IFACE2;CUSTOM_U_TARGET_TYPE_EXECUTABLE;CUSTOM_U_IFACE1;CUSTOM_U_TARGET_NAME_CUSTOMTRANSITIVEPROPERTIES;CUSTOM_U_OBJECT1_IFACE"
|
"$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_U>" "CUSTOM_U_MAIN;CUSTOM_U_STATIC1_IFACE;CUSTOM_U_IFACE2;CUSTOM_U_TARGET_TYPE_EXECUTABLE;CUSTOM_U_IFACE1;CUSTOM_U_TARGET_NAME_CUSTOMTRANSITIVEPROPERTIES;CUSTOM_U_OBJECT1_IFACE"
|
||||||
"$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_V>" "CUSTOM_V_MAIN;CUSTOM_V_STATIC1_IFACE;CUSTOM_V_IFACE1"
|
"$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_V>" "CUSTOM_V_MAIN;CUSTOM_V_STATIC1_IFACE;CUSTOM_V_IFACE1"
|
||||||
"$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_W>" "CUSTOM_W_MAIN;CUSTOM_W_IFACE1;CUSTOM_W_OBJECT1_IFACE"
|
"$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_W>" "CUSTOM_W_MAIN;CUSTOM_W_IFACE1;CUSTOM_W_OBJECT1_IFACE"
|
||||||
|
COMMAND check-args
|
||||||
|
"$<TARGET_PROPERTY:iface1,LINK_LIBRARIES>" ""
|
||||||
|
"$<TARGET_PROPERTY:iface1,INTERFACE_LINK_LIBRARIES>" ""
|
||||||
|
"$<TARGET_PROPERTY:iface2,LINK_LIBRARIES>" ""
|
||||||
|
"$<TARGET_PROPERTY:iface2,INTERFACE_LINK_LIBRARIES>" "iface1"
|
||||||
|
"$<TARGET_PROPERTY:static1,LINK_LIBRARIES>" "iface2"
|
||||||
|
"$<TARGET_PROPERTY:static1,INTERFACE_LINK_LIBRARIES>" "$<LINK_ONLY:iface2$<ANGLE-R>"
|
||||||
|
"$<TARGET_PROPERTY:CustomTransitiveProperties,LINK_LIBRARIES>" "static1;object1"
|
||||||
|
"$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_LINK_LIBRARIES>" ""
|
||||||
|
COMMAND check-args
|
||||||
|
"$<TARGET_PROPERTY:iface10,LINK_LIBRARIES>" ""
|
||||||
|
"$<TARGET_PROPERTY:iface10,INTERFACE_LINK_LIBRARIES>" ""
|
||||||
|
"$<TARGET_PROPERTY:iface11,LINK_LIBRARIES>" ""
|
||||||
|
"$<TARGET_PROPERTY:iface11,INTERFACE_LINK_LIBRARIES>" "iface10"
|
||||||
|
"$<TARGET_PROPERTY:static10,LINK_LIBRARIES>" "iface11;iface10"
|
||||||
|
# _/ \__
|
||||||
|
# / \
|
||||||
|
# "static10[iface11];iface11[iface10]"
|
||||||
|
"$<TARGET_PROPERTY:static10,INTERFACE_LINK_LIBRARIES>" "iface11;iface10"
|
||||||
|
"$<TARGET_PROPERTY:static11,LINK_LIBRARIES>" "static10;iface11;iface11;iface10"
|
||||||
|
# __/ __/ \__ \__________
|
||||||
|
# / / \ \
|
||||||
|
# "static11[static10;iface11];static10[iface11;iface11[iface10]]"
|
||||||
|
"$<TARGET_PROPERTY:static11,INTERFACE_LINK_LIBRARIES>" "static10;iface11;iface11;iface10"
|
||||||
|
"$<TARGET_PROPERTY:main10,LINK_LIBRARIES>" "static11;static10;static10;iface11;iface11;iface10"
|
||||||
|
# _______/ _______/ | | \______ \______________
|
||||||
|
# / / | | \ \
|
||||||
|
# "main10[static11;static10];static11[static10;iface11;static10[iface11;iface11[iface10]]]"
|
||||||
|
"$<TARGET_PROPERTY:main10,INTERFACE_LINK_LIBRARIES>" ""
|
||||||
)
|
)
|
||||||
|
16
Tests/CustomTransitiveProperties/check-args.c
Normal file
16
Tests/CustomTransitiveProperties/check-args.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
int i;
|
||||||
|
for (i = 2; i < argc; i += 2) {
|
||||||
|
if (strcmp(argv[i - 1], argv[i]) != 0) {
|
||||||
|
fprintf(stderr, "Argument %d expected '%s' but got '%s'.\n", i, argv[i],
|
||||||
|
argv[i - 1]);
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
@@ -32,6 +32,25 @@ main CUSTOM_V: 'CUSTOM_V_MAIN;CUSTOM_V_STATIC1_IFACE;CUSTOM_V_IFACE1'
|
|||||||
main INTERFACE_CUSTOM_V: ''
|
main INTERFACE_CUSTOM_V: ''
|
||||||
main CUSTOM_W: 'CUSTOM_W_MAIN;CUSTOM_W_IFACE1;CUSTOM_W_OBJECT1_IFACE'
|
main CUSTOM_W: 'CUSTOM_W_MAIN;CUSTOM_W_IFACE1;CUSTOM_W_OBJECT1_IFACE'
|
||||||
main INTERFACE_CUSTOM_W: ''
|
main INTERFACE_CUSTOM_W: ''
|
||||||
|
|
||||||
|
iface1 LINK_LIBRARIES: ''
|
||||||
|
iface1 INTERFACE_LINK_LIBRARIES: ''
|
||||||
|
iface2 LINK_LIBRARIES: ''
|
||||||
|
iface2 INTERFACE_LINK_LIBRARIES: 'iface1'
|
||||||
|
static1 LINK_LIBRARIES: 'iface2'
|
||||||
|
static1 INTERFACE_LINK_LIBRARIES: '\$<LINK_ONLY:iface2>'
|
||||||
|
main LINK_LIBRARIES: 'static1;object1'
|
||||||
|
main INTERFACE_LINK_LIBRARIES: ''
|
||||||
|
iface10 LINK_LIBRARIES: ''
|
||||||
|
iface10 INTERFACE_LINK_LIBRARIES: ''
|
||||||
|
iface11 LINK_LIBRARIES: ''
|
||||||
|
iface11 INTERFACE_LINK_LIBRARIES: 'iface10'
|
||||||
|
static10 LINK_LIBRARIES: 'iface11;iface10'
|
||||||
|
static10 INTERFACE_LINK_LIBRARIES: 'iface11;iface10'
|
||||||
|
static11 LINK_LIBRARIES: 'static10;iface11;iface11;iface10'
|
||||||
|
static11 INTERFACE_LINK_LIBRARIES: 'static10;iface11;iface11;iface10'
|
||||||
|
main10 LINK_LIBRARIES: 'static11;static10;static10;iface11;iface11;iface10'
|
||||||
|
main10 INTERFACE_LINK_LIBRARIES: ''
|
||||||
]])
|
]])
|
||||||
string(REGEX REPLACE "\r\n" "\n" expect "${expect}")
|
string(REGEX REPLACE "\r\n" "\n" expect "${expect}")
|
||||||
string(REGEX REPLACE "\n+$" "" expect "${expect}")
|
string(REGEX REPLACE "\n+$" "" expect "${expect}")
|
||||||
|
@@ -1,6 +1,3 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef CUSTOM_A_IFACE1
|
#ifdef CUSTOM_A_IFACE1
|
||||||
# error "CUSTOM_A_IFACE1 incorrectly defined"
|
# error "CUSTOM_A_IFACE1 incorrectly defined"
|
||||||
#endif
|
#endif
|
||||||
@@ -117,21 +114,7 @@
|
|||||||
extern int static1(void);
|
extern int static1(void);
|
||||||
extern int object1(void);
|
extern int object1(void);
|
||||||
|
|
||||||
int check_args(int argc, char** argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
int result = 0;
|
return static1() + object1();
|
||||||
int i;
|
|
||||||
for (i = 2; i < argc; i += 2) {
|
|
||||||
if (strcmp(argv[i - 1], argv[i]) != 0) {
|
|
||||||
fprintf(stderr, "Argument %d expected '%s' but got '%s'.\n", i, argv[i],
|
|
||||||
argv[i - 1]);
|
|
||||||
result = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
return static1() + object1() + check_args(argc, argv);
|
|
||||||
}
|
}
|
||||||
|
7
Tests/CustomTransitiveProperties/main10.c
Normal file
7
Tests/CustomTransitiveProperties/main10.c
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
extern int static10(void);
|
||||||
|
extern int static11(void);
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
return static10() + static11();
|
||||||
|
}
|
4
Tests/CustomTransitiveProperties/static10.c
Normal file
4
Tests/CustomTransitiveProperties/static10.c
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
int static10(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
4
Tests/CustomTransitiveProperties/static11.c
Normal file
4
Tests/CustomTransitiveProperties/static11.c
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
int static11(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Reference in New Issue
Block a user