[Cmake-commits] CMake branch, next, updated. v3.0.0-3991-gbd3e576
Stephen Kelly
steveire at gmail.com
Fri Jun 27 12:20:31 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via bd3e576ca8c20c3fdd14ae751781dc5b71df16d3 (commit)
via 3db348e57703d676c3cf5d149a59efdc56be83ad (commit)
via 9046f2ce2cc417a5869ae45421d3fa23e84ec03c (commit)
from 24955168c5d77590b91574fc23524329eaac9ebf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd3e576ca8c20c3fdd14ae751781dc5b71df16d3
commit bd3e576ca8c20c3fdd14ae751781dc5b71df16d3
Merge: 2495516 3db348e
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jun 27 12:20:30 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jun 27 12:20:30 2014 -0400
Merge topic 'fix-circular-transitive-properties-segfault' into next
3db348e5 Target: Return null when a transitive property is not defined.
9046f2ce Genex: Don't segfault on transitive properties in link implementation.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3db348e57703d676c3cf5d149a59efdc56be83ad
commit 3db348e57703d676c3cf5d149a59efdc56be83ad
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 11 14:28:24 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Jun 27 16:13:26 2014 +0200
Target: Return null when a transitive property is not defined.
Commit v2.8.11~310^2~1 (Keep track of INCLUDE_DIRECTORIES as a vector of
structs., 2012-11-19) added special case of INCLUDE_DIRECTORIES
for the purpose of origin-tracking of individual entries in the property. It
introduced a bug in that it returned an empty string instead of '0' in the
case that no includes have been set.
Commit v2.8.11~289^2~2 (Handle INTERFACE properties transitively for includes
and defines., 2012-09-23) introduced transitive handling of the property
through the link implementation, together with a whitelist of properties
which would be evaluated transitively. Because of the bug introduced
previously, the 'prop' in TargetPropertyNode is non-null,
meaning that the content (the empty string) would be evaluated as a generator
expression. This was harmless as the follow-up code was only for 'INTERFACE_'
variants of target properties, so the effect was the same.
Commits v2.8.11~280^2~2 (Keep track of properties used to determine linker
libraries., 2012-11-05) and v2.8.11~280^2~1 (Add API to calculate
link-interface-dependent bool properties or error., 2013-01-06) added a way
to track and report errors on properties which both determine and are
determined by the link implementation. This was later used in generator
expression evaluation by commit v2.8.11~252^2~2 (Make INTERFACE determined
properties readable in generator expressions., 2013-01-19). If a property
is unset (null), and the link implementation of the target was not being
evaluated, this commit made it possible to evaluate the property from the
link implementation instead. If the link implementation was being evaluated,
an empty string was returned from the generator expression evaluation, which
might be later reported as an error.
The above logic was written for 'compatible interface' properties, but in
fact it should have also included other properties. Because of the
empty-string-instead-of-null bug, this code block is not entered for the
INCLUDE_DIRECTORIES property. At this point, however, the bug still does
not significantly affect behavior, because the follow-up code is still a
no-op for the INCLUDE_DIRECTORIES property, and an empty string is returned
regardless. Commit v2.8.11~189^2~6 (Use the link information as a source of
compile definitions and includes., 2013-02-12) refactored the logic, but also
without a change in behavior.
Commit v2.8.11~156^2~2 (Expand includes and defines transitively
in 'external' genexes., 2013-02-13) refactored the logic again, this time with
a change of behavior. The INCLUDE_DIRECTORIES property was then mapped to
INTERFACE_INCLUDE_DIRECTORIES during transitive generator expression
evaluation. Because the transitive evaluation involved evaluation of the
link implementation, this introduced a recursive loop and a segfault with
code like:
add_library(empty1 ...)
add_library(empty2 ...)
target_link_libraries(empty1
PRIVATE
$<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
)
As there is no real use-case for reading a target property like that while
evaluating the link implementation, this went unnoticed. The same pattern
was followed for other special-cased reads of transitive target properties
such as COMPILE_DEFINITIONS.
The segfault was fixed in the parent commit, but change the property to
return null when appropriate for other future uses.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 05aacbb..8e334ff 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3265,6 +3265,11 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
if(prop == "INCLUDE_DIRECTORIES")
{
+ if (this->Internal->IncludeDirectoriesEntries.empty())
+ {
+ return 0;
+ }
+
static std::string output;
output = "";
std::string sep;
@@ -3283,6 +3288,11 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
if(prop == "COMPILE_OPTIONS")
{
+ if (this->Internal->CompileOptionsEntries.empty())
+ {
+ return 0;
+ }
+
static std::string output;
output = "";
std::string sep;
@@ -3301,6 +3311,11 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
if(prop == "COMPILE_FEATURES")
{
+ if (this->Internal->CompileFeaturesEntries.empty())
+ {
+ return 0;
+ }
+
static std::string output;
output = "";
std::string sep;
@@ -3319,6 +3334,11 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
if(prop == "COMPILE_DEFINITIONS")
{
+ if (this->Internal->CompileDefinitionsEntries.empty())
+ {
+ return 0;
+ }
+
static std::string output;
output = "";
std::string sep;
@@ -3337,6 +3357,11 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
if(prop == "LINK_LIBRARIES")
{
+ if (this->Internal->LinkImplementationPropertyEntries.empty())
+ {
+ return 0;
+ }
+
static std::string output;
output = "";
std::string sep;
@@ -3359,6 +3384,11 @@ const char *cmTarget::GetProperty(const std::string& prop,
if(prop == "SOURCES")
{
+ if (this->Internal->SourceEntries.empty())
+ {
+ return 0;
+ }
+
cmOStringStream ss;
const char* sep = "";
typedef cmTargetInternals::TargetPropertyEntry
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9046f2ce2cc417a5869ae45421d3fa23e84ec03c
commit 9046f2ce2cc417a5869ae45421d3fa23e84ec03c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 11 16:04:53 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Jun 27 16:13:26 2014 +0200
Genex: Don't segfault on transitive properties in link implementation.
Commit v2.8.11~156^2~2 (Expand includes and defines transitively
in 'external' genexes., 2013-02-13) introduced a recursive loop
and a segfault during evaluation of a link implementation which
depends on a transitive property, such as
add_library(empty1 ...)
add_library(empty2 ...)
target_link_libraries(empty1
PRIVATE
$<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
)
There is no use-case for code like that currently, but it should not
segfault.
Avoid the recursion by reporting an error early if a case like this
is found.
Add a backtrace to link interface access APIs and use it while
transitively evaluating generator expressions through the link
interface. This allows reporting the target_link_libraries line
which specifies a target with a problematic INTERFACE property.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index c925869..c230ac6 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1028,6 +1028,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{
if (dagCheckerParent->EvaluatingLinkLibraries())
{
+#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \
+ (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) ||
+ if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE)
+ false)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<TARGET_PROPERTY:...> expression in link libraries "
+ "evaluation depends on target property which is transitive "
+ "over the link libraries, creating a recursion.");
+ return std::string();
+ }
+#undef TRANSITIVE_PROPERTY_COMPARE
+
if(!prop)
{
return std::string();
@@ -1085,7 +1098,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::vector<cmTarget const*> tgts;
target->GetTransitivePropertyTargets(context->Config,
- headTarget, tgts);
+ headTarget, tgts,
+ &context->Backtrace);
if (!tgts.empty())
{
linkedTargetsContent =
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index aa0ed56..05aacbb 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3700,9 +3700,10 @@ void cmTarget::ExpandLinkItems(std::string const& prop,
std::string const& config,
cmTarget const* headTarget,
bool usage_requirements_only,
- std::vector<cmLinkItem>& items) const
+ std::vector<cmLinkItem>& items,
+ cmListFileBacktrace *backtrace) const
{
- cmGeneratorExpression ge;
+ cmGeneratorExpression ge(backtrace);
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
if(usage_requirements_only)
{
@@ -6048,7 +6049,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
// Imported targets have their own link interface.
if(this->IsImported())
{
- return this->GetImportLinkInterface(config, head, false);
+ return this->GetImportLinkInterface(config, head, false, 0);
}
// Link interfaces are not supported for executables that do not
@@ -6070,7 +6071,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
cmTargetInternals::OptionalLinkInterface iface;
iface.ExplicitLibraries =
this->ComputeLinkInterfaceLibraries(config, iface, head, false,
- iface.Exists);
+ iface.Exists, 0);
if (iface.Exists)
{
this->Internal->ComputeLinkInterface(this, config, iface,
@@ -6094,12 +6095,14 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
cmTarget::LinkInterface const*
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* head,
- bool usage_requirements_only) const
+ bool usage_requirements_only,
+ cmListFileBacktrace *backtrace) const
{
// Imported targets have their own link interface.
if(this->IsImported())
{
- return this->GetImportLinkInterface(config, head, usage_requirements_only);
+ return this->GetImportLinkInterface(config, head,
+ usage_requirements_only, backtrace);
}
// Link interfaces are not supported for executables that do not
@@ -6125,7 +6128,7 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
iface.ExplicitLibraries =
this->ComputeLinkInterfaceLibraries(config, iface, head,
usage_requirements_only,
- iface.Exists);
+ iface.Exists, backtrace);
// Store the information for this configuration.
cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface);
@@ -6139,7 +6142,8 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
cmTarget::LinkInterface const*
cmTarget::GetImportLinkInterface(const std::string& config,
cmTarget const* headTarget,
- bool usage_requirements_only) const
+ bool usage_requirements_only,
+ cmListFileBacktrace *backtrace) const
{
cmTarget::ImportInfo const* info = this->GetImportInfo(config);
if(!info)
@@ -6161,7 +6165,7 @@ cmTarget::GetImportLinkInterface(const std::string& config,
cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
headTarget, usage_requirements_only,
- iface.Libraries);
+ iface.Libraries, backtrace);
{
std::vector<std::string> deps;
cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
@@ -6186,7 +6190,7 @@ void processILibs(const std::string& config,
{
tgts.push_back(item.Target);
if(cmTarget::LinkInterface const* iface =
- item.Target->GetLinkInterfaceLibraries(config, headTarget, false))
+ item.Target->GetLinkInterfaceLibraries(config, headTarget, false, 0))
{
for(std::vector<cmLinkItem>::const_iterator
it = iface->Libraries.begin();
@@ -6224,7 +6228,8 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const
//----------------------------------------------------------------------------
void cmTarget::GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
- std::vector<cmTarget const*> &tgts) const
+ std::vector<cmTarget const*> &tgts,
+ cmListFileBacktrace *backtrace) const
{
// The $<LINK_ONLY> expression may be in a link interface to specify private
// link dependencies that are otherwise excluded from usage requirements.
@@ -6237,7 +6242,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
this->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if(cmTarget::LinkInterface const* iface =
this->GetLinkInterfaceLibraries(config, headTarget,
- usage_requirements_only))
+ usage_requirements_only, backtrace))
{
for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin();
it != iface->Libraries.end(); ++it)
@@ -6252,10 +6257,11 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
//----------------------------------------------------------------------------
const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
- LinkInterface& iface,
- cmTarget const* headTarget,
- bool usage_requirements_only,
- bool &exists) const
+ LinkInterface& iface,
+ cmTarget const* headTarget,
+ bool usage_requirements_only,
+ bool &exists,
+ cmListFileBacktrace *backtrace) const
{
// Construct the property name suffix for this configuration.
std::string suffix = "_";
@@ -6341,7 +6347,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
// The interface libraries have been explicitly set.
this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config,
headTarget, usage_requirements_only,
- iface.Libraries);
+ iface.Libraries, backtrace);
}
else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
|| this->PolicyStatusCMP0022 == cmPolicies::OLD)
@@ -6365,7 +6371,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
{
this->ExpandLinkItems(newProp, newExplicitLibraries, config,
headTarget, usage_requirements_only,
- ifaceLibs);
+ ifaceLibs, backtrace);
}
if (ifaceLibs != impl->Libraries)
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 9d1f966..8b18cb7 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -281,10 +281,12 @@ public:
cmTarget const* headTarget) const;
LinkInterface const* GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget,
- bool usage_requirements_only) const;
+ bool usage_requirements_only,
+ cmListFileBacktrace *backtrace) const;
void GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
- std::vector<cmTarget const*> &libs) const;
+ std::vector<cmTarget const*> &libs,
+ cmListFileBacktrace *backtrace = 0) const;
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
@@ -758,13 +760,15 @@ private:
LinkInterface const*
GetImportLinkInterface(const std::string& config, cmTarget const* head,
- bool usage_requirements_only) const;
+ bool usage_requirements_only,
+ cmListFileBacktrace *backtrace) const;
const char* ComputeLinkInterfaceLibraries(const std::string& config,
- LinkInterface& iface,
- cmTarget const* head,
- bool usage_requirements_only,
- bool &exists) const;
+ LinkInterface& iface,
+ cmTarget const* head,
+ bool usage_requirements_only,
+ bool &exists,
+ cmListFileBacktrace* backtrace) const;
LinkImplementation const*
GetLinkImplementationLibrariesInternal(const std::string& config,
@@ -780,7 +784,8 @@ private:
void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config, cmTarget const* headTarget,
bool usage_requirements_only,
- std::vector<cmLinkItem>& items) const;
+ std::vector<cmLinkItem>& items,
+ cmListFileBacktrace *backtrace) const;
void LookupLinkItems(std::vector<std::string> const& names,
std::vector<cmLinkItem>& items) const;
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt
new file mode 100644
index 0000000..7e002f5
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at LinkImplementationCycle1.cmake:5 \(target_link_libraries\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>
+
+ \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on
+ target property which is transitive over the link libraries, creating a
+ recursion.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:8 \(include\)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake
new file mode 100644
index 0000000..4b60214
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake
@@ -0,0 +1,8 @@
+
+add_library(empty1 empty.cpp)
+add_library(empty2 empty.cpp)
+
+target_link_libraries(empty1
+ LINK_PUBLIC
+ $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
+)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt
new file mode 100644
index 0000000..2f72de6
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at LinkImplementationCycle2.cmake:5 \(target_link_libraries\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>
+
+ \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on
+ target property which is transitive over the link libraries, creating a
+ recursion.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:8 \(include\)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake
new file mode 100644
index 0000000..557eac1
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake
@@ -0,0 +1,8 @@
+
+add_library(empty1 empty.cpp)
+add_library(empty2 empty.cpp)
+
+target_link_libraries(empty1
+ LINK_PUBLIC
+ $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
+)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake
new file mode 100644
index 0000000..0f921d4
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake
@@ -0,0 +1,10 @@
+
+add_library(empty1 empty.cpp)
+add_library(empty2 empty.cpp)
+
+# This is OK, because evaluating the INCLUDE_DIRECTORIES is not affected by
+# the content of the INTERFACE_LINK_LIBRARIES.
+target_link_libraries(empty1
+ INTERFACE
+ $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
+)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt
new file mode 100644
index 0000000..3d1da50
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at LinkImplementationCycle4.cmake:14 \(target_link_libraries\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>
+
+ \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on
+ target property which is transitive over the link libraries, creating a
+ recursion.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:8 \(include\)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake
new file mode 100644
index 0000000..ab6d0b2
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake
@@ -0,0 +1,14 @@
+
+add_library(empty1 empty.cpp)
+add_library(empty2 empty.cpp)
+
+# The INTERFACE_INCLUDE_DIRECTORIES do not depend on the link interface.
+# On its own, this is fine. It is only when used by empty3 that an error
+# is appropriately issued.
+target_link_libraries(empty1
+ INTERFACE
+ $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
+)
+
+add_library(empty3 empty.cpp)
+target_link_libraries(empty3 empty1)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt
new file mode 100644
index 0000000..28bbc12
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at LinkImplementationCycle5.cmake:10 \(target_link_libraries\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>
+
+ \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on
+ target property which is transitive over the link libraries, creating a
+ recursion.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:8 \(include\)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake
new file mode 100644
index 0000000..dc180e3
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake
@@ -0,0 +1,10 @@
+
+add_library(empty1 INTERFACE IMPORTED)
+add_library(empty2 INTERFACE IMPORTED)
+
+set_property(TARGET empty1 PROPERTY INTERFACE_LINK_LIBRARIES
+ $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
+)
+
+add_library(empty3 empty.cpp)
+target_link_libraries(empty3 empty1)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt
new file mode 100644
index 0000000..1ea624d
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at LinkImplementationCycle6.cmake:14 \(target_link_libraries\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>
+
+ \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on
+ target property which is transitive over the link libraries, creating a
+ recursion.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:8 \(include\)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake
new file mode 100644
index 0000000..91252d0
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake
@@ -0,0 +1,14 @@
+
+add_library(empty1 SHARED empty.cpp)
+add_library(empty2 SHARED empty.cpp)
+
+# The INTERFACE_INCLUDE_DIRECTORIES do not depend on the link interface.
+# On its own, this is fine. It is only when used by empty3 that an error
+# is appropriately issued.
+target_link_libraries(empty1
+ INTERFACE
+ $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
+)
+
+add_library(empty3 SHARED empty.cpp)
+target_link_libraries(empty3 empty1)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
index 0ee3238..645a57d 100644
--- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
@@ -15,3 +15,9 @@ run_cmake(BadInvalidName5)
run_cmake(BadInvalidName6)
run_cmake(BadInvalidName7)
run_cmake(BadInvalidName8)
+run_cmake(LinkImplementationCycle1)
+run_cmake(LinkImplementationCycle2)
+run_cmake(LinkImplementationCycle3)
+run_cmake(LinkImplementationCycle4)
+run_cmake(LinkImplementationCycle5)
+run_cmake(LinkImplementationCycle6)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+ return 0;
+}
-----------------------------------------------------------------------
Summary of changes:
Source/cmGeneratorExpressionEvaluator.cxx | 16 ++++-
Source/cmTarget.cxx | 72 +++++++++++++++-----
Source/cmTarget.h | 21 +++---
.../LinkImplementationCycle1-result.txt} | 0
.../LinkImplementationCycle1-stderr.txt | 10 +++
.../LinkImplementationCycle1.cmake | 8 +++
.../LinkImplementationCycle2-result.txt} | 0
.../LinkImplementationCycle2-stderr.txt | 10 +++
.../LinkImplementationCycle2.cmake | 8 +++
.../LinkImplementationCycle3-result.txt} | 0
.../LinkImplementationCycle3-stderr.txt} | 0
.../LinkImplementationCycle3.cmake | 10 +++
.../LinkImplementationCycle4-result.txt} | 0
.../LinkImplementationCycle4-stderr.txt | 10 +++
.../LinkImplementationCycle4.cmake | 14 ++++
.../LinkImplementationCycle5-result.txt} | 0
.../LinkImplementationCycle5-stderr.txt | 10 +++
.../LinkImplementationCycle5.cmake | 10 +++
.../LinkImplementationCycle6-result.txt} | 0
.../LinkImplementationCycle6-stderr.txt | 10 +++
.../LinkImplementationCycle6.cmake | 14 ++++
.../RunCMakeTest.cmake | 6 ++
.../empty.cpp | 0
23 files changed, 202 insertions(+), 27 deletions(-)
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt} (100%)
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt} (100%)
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake
copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt} (100%)
copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt} (100%)
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt} (100%)
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt} (100%)
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt} (100%)
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt
create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake
copy Tests/RunCMake/{CMP0022 => TargetPropertyGeneratorExpressions}/empty.cpp (100%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list