在cmake中显示目标的链接库列表 [英] Displaying a target's list of linked libraries in cmake

查看:112
本文介绍了在cmake中显示目标的链接库列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以打印出通过target_link_libraries命令链接到目标的库文件名的列表

Is there a way to print a list the filenames for the libraries linked into a target via the target_link_libraries command

甚至更好,将所有目标的依赖项复制到

or even better, have all a target's dependencies copied to a specific folder?

推荐答案

实际上不是(*)

但是,您可以使用cmake变量来收集要链接的库的名称(使用 set(... list(APPEND ... 命令),然后在您的 target_link_libraries 命令中使用此变量:

However, you can use a cmake variable to collect the name of the libraries that you want to link (using the set( ... or the list(APPEND ... command), and then use this variable in your target_link_libraries command:

target_link_libraries(<targetname> ${YOUR_CMAKE_VARIABLE})

同一变量也可用于创建复制命令(例如使用此自定义目标

The same variable can also be used to create your copy commands (for example using this custom target)



(*)提出了类似的问题此处,但没有肯定的答案。


(*) A similar question was asked here, and it got no definitive answer.

这篇关于在cmake中显示目标的链接库列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆