From 92a2ab70b61f978e96c8a6eaae0cce1c7422a59f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 12 Mar 2013 17:13:42 -0400 Subject: [PATCH 1/2] Avoid crash when checking property link dependencies without link info Teach the isLinkDependentProperty helper added by commit e9879910 (Make INTERFACE determined properties readable in generator expressions, 2013-01-19) to return early if no link information is available. --- Source/cmTarget.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 003f3d8303..c8f532e57e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4839,6 +4839,10 @@ bool isLinkDependentProperty(cmTarget *tgt, const std::string &p, const char *config) { cmComputeLinkInformation *info = tgt->GetLinkInformation(config); + if(!info) + { + return false; + } const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); From ab079ee6822c4ab151b0df8f9a529088607d3629 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 12 Mar 2013 17:25:59 -0400 Subject: [PATCH 2/2] Avoid crash when checking property compatibility without link info Teach the compatibility check added by commit 042ecf04 (Add API to calculate link-interface-dependent bool properties or error, 2013-01-06) to return early if no link information is available. This avoids crashing in a case that should fail with an error message. --- Source/cmTarget.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c8f532e57e..07da31fc00 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4699,6 +4699,10 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget *tgt, || (!impliedByUse && !explicitlySet)); cmComputeLinkInformation *info = tgt->GetLinkInformation(config); + if(!info) + { + return propContent; + } const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); bool propInitialized = explicitlySet;