<div dir="ltr">I submitted a patch to update `<span style="font-size:12.8000001907349px">CMakeExpandImportedTargets` with `</span><span style="font-size:12.8000001907349px">INTERFACE_LINK_LIBRARIES`. Shortly after I read the discussion at</span><span style="font-size:12.8000001907349px"> </span><a href="http://www.cmake.org/Bug/view.php?id=15299" target="_blank" style="font-size:12.8000001907349px">http://www.<span class="">cmake</span>.org/Bug/view.php?id=15299</a> which suggested `<span style="font-size:12.8000001907349px">CMakeExpandImportedTargets` is deprecated and one should use `BundleUtilities` instead.</span><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Well, it seems that `BundleUtilities` can't expand a single static imported library target to the list of all dependent libraries (that's what I need) so I think </span>`<span style="font-size:12.8000001907349px">CMakeExpandImportedTargets` is still benefitial and could be benefitial to others, too.</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">My patch enables `</span><span style="font-size:12.8000001907349px">CMakeExpandImportedTargets` to use the </span><span style="font-size:12.8000001907349px">`</span><span style="font-size:12.8000001907349px">INTERFACE_LINK_LIBRARIES` property and also resolves the $<CONFIG>, $<NOT> and $<0|1:> generator expressions. I found no elegant way to resolve all generator expressions (`file(GENERATE ...)` can't be used since it does not output the resolved content instantly).</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Tamas</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 15, 2015 at 5:56 PM, Tamás Kenéz <span dir="ltr"><<a href="mailto:tamas.kenez@gmail.com" target="_blank">tamas.kenez@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>The CMakeExpandedImportedTargets module used only the deprecated IMPORTED_LINK_INTERFACE_LIBRARIES property to resolve transitive dependencies.</div><div>Since the current `install(EXPORT ...)` command generates target files that populate INTERFACE_LINK_LIBRARIES instead, the expand module was not working correctly with the imported libraries generated by `install(EXPORT ...)`.</div><div><br></div><div>I considered this a bugfix so I based the commit onto the release branch.</div><div><br></div><div>Please review and apply if it's ok.</div><div>Tamas</div><div><br></div><div><br></div><div>From f2df88ec4180595a3fcc4c6be9b2d38e46162cc3 Mon Sep 17 00:00:00 2001</div><div>From: Tamas Kenez <<a href="mailto:tamas.kenez@gmail.com" target="_blank">tamas.kenez@gmail.com</a>></div><div>Date: Wed, 15 Jul 2015 17:47:50 +0200</div><div>Subject: [PATCH] CMakeExpandImportedTargets: use INTERFACE_LINK_LIBRARIES if</div><div> non-empty</div><div><br></div><div>The deprecated IMPORTED_LINK_INTERFACE_LIBRARIES should be</div><div>overridden by INTERFACE_LINK_LIBRARIES if it's non-empty.</div><div><br></div><div>Unlike IMPORTED_LINK_INTERFACE_LIBRARIES, INTERFACE_LINK_LIBRARIES</div><div>usually contains config-related generator expressions which must</div><div>be resolved according to the selected configuration.</div><div>---</div><div> Modules/CMakeExpandImportedTargets.cmake | 22 +++++++++++++++++++++-</div><div> 1 file changed, 21 insertions(+), 1 deletion(-)</div><div><br></div><div>diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake</div><div>index 8ac3364..b110e51 100644</div><div>--- a/Modules/CMakeExpandImportedTargets.cmake</div><div>+++ b/Modules/CMakeExpandImportedTargets.cmake</div><div>@@ -102,7 +102,27 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )</div><div>             list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse)</div><div> </div><div>             get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse})</div><div>-            get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} )</div><div>+            get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" INTERFACE_LINK_LIBRARIES)</div><div>+            if(_linkInterfaceLibs)</div><div>+               # resolve $<CONFIG:...> generator expressions</div><div>+               string(REGEX REPLACE "\\$<CONFIG:${_importedConfigToUse}>" "1"</div><div>+                  _linkInterfaceLibs "${_linkInterfaceLibs}")</div><div>+               string(REGEX REPLACE "\\$<CONFIG:[^>]*>" "0"</div><div>+                  _linkInterfaceLibs "${_linkInterfaceLibs}")</div><div>+               # resolve $<NOT:(0|1)></div><div>+               string(REGEX REPLACE "\\$<NOT:0>" "1"</div><div>+                  _linkInterfaceLibs "${_linkInterfaceLibs}")</div><div>+               string(REGEX REPLACE "\\$<NOT:1>" "0"</div><div>+                  _linkInterfaceLibs "${_linkInterfaceLibs}")</div><div>+               # resolve $<(0|1):...></div><div>+               # empty items will be ignored by `foreach` later</div><div>+               string(REGEX REPLACE "\\$<0:[^>]*>" ""</div><div>+                  _linkInterfaceLibs "${_linkInterfaceLibs}")</div><div>+               string(REGEX REPLACE "\\$<1:([^>]*)>" "\\1"</div><div>+                  _linkInterfaceLibs "${_linkInterfaceLibs}")</div><div>+            else()</div><div>+               get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} )</div><div>+            endif()</div><div> </div><div>             list(APPEND _CCSR_NEW_REQ_LIBS  "${_importedLocation}")</div><div> #            message(STATUS "Appending lib ${_CURRENT_LIB} as ${_importedLocation}")</div><span class="HOEnZb"><font color="#888888"><div>-- </div><div>1.9.4.msysgit.2</div><div> </div></font></span></div>
</blockquote></div><br></div>