I think you need something like CMakeExpandImportedTargets.cmake ( https://cmake.org/cmake/help/latest/module/CMakeExpandImportedTargets.html). But that module has been deprecated for a while and does not support some newer CMake features.
Instead, feel free to try out my fork: https://gist.github.com/tamaskenez/ef98237fff654c6d28b5 . This fork adds support for IMPORTED_IMPLIB, INTERFACE_LINK_LIBRARIES and $<CONFIG:> expressions. It recursively resolves all dependencies for the given configuration (Debug, Release, ...) Tamas On Fri, Jan 22, 2016 at 11:01 PM, Tom Kacvinsky < [email protected]> wrote: > Ah yes, that was it. Switching to 3.3.2 did the trick. Time to upgrade > cmake. > > On Fri, Jan 22, 2016 at 4:40 PM, Tom Kacvinsky < > [email protected]> wrote: > >> I am now having a problem with transitive dependencies. I need all >> libraries that are linked in. I am missing the ones that are linked in >> transitively. Modified code is, ignoring J. Decker's suggestion about >> using generator expressions to get the path to the target's output. >> >> get_property(libs TARGET a_target PROPERTY LINK_LIBRARIES) >> foreach(lib ${libs}) >> if(TARGET ${lib}) >> # If this is a library, get its transitive dependencies >> get_property(trans TARGET ${lib} PROPERTY INTERFACE_LINK_LIBRARIES) >> foreach(tran ${trans}) >> if(TARGET ${tran}) >> get_property(path TARGET ${tran} PROPERTY LOCATION) >> file(APPEND "${CMAKE_BINARY_DIR/libs.txt" "${path}\n") >> endif() >> endforeach() >> get_property(path TARGET ${lib} PROPERTY LOCATION) >> file(APPEND "${CMAKE_BINARY_DIR}/libs.txt" "${path}\n") >> else() >> file(APPEND "${CMAKE_BINARY_DIR}/libs.txt" "${lib}\n") >> endif() >> endforeach() >> >> I am using cmake 2.8.11.2, perhaps this property doesn't do what I >> thought it would with this version of cmake? >> >> Thanks, >> >> Tom >> >> On Fri, Jan 22, 2016 at 9:23 AM, Tom Kacvinsky < >> [email protected]> wrote: >> >>> I have need for a cross platform methods of getting libraries linked >>> into an executable. >>> >>> Say for instance, we have >>> >>> add_library(foo STATIC a.c) >>> add_exceutable(bar b.c) >>> target_link_libraries(bar foo) >>> >>> So I know for that bar has a dependency on foo.lib (on Windows) and >>> libfoo.a on Linux. >>> >>> And so forth. What I would like to do is after everything is set up, >>> query the properties of bar >>> and find the list of libraries linked into bar in such a fashion I get >>> that platform's specific library name (instead of the library's target >>> name). >>> >>> IS this possible? I read the docs and didn't see a property for >>> getting this list. Did I miss something? If so I plan on using >>> either get_property of get_target_property. >>> >>> Thanks. >>> >> >> > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
