什么是默认的target_link_libraries隐私设置? [英] What is default target_link_libraries privacy setting?

查看:1119
本文介绍了什么是默认的target_link_libraries隐私设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道默认的 target_link_libraries 隐私是什么。

I wonder what is the default target_link_libraries privacy.

我在CMake中添加了一行:

I added line in CMake:

target_link_libraries(myTarget
        libraryA
        libraryB
        )

但是我不知道它是 PRIVATE 还是 PUBLIC Interface
我检查了文档,但我没有没有看到我的问题的答案:(

But I don't know if it is PRIVATE or PUBLIC or maybe INTERFACE. I check documentation, but I don't see answer for my question :(

编辑:

我发现某事


最后一点,如果您调用target_link_libraries()而不是
指定PRIVATE,PUBLIC或INTERFACE中的任何一个,您可能会想起
认为它将被视为PUBLIC。实际上,
比这复杂得多。它可能被视为PUBLIC或
PRIVATE,具体取决于执行了哪些其他target_link_library()调用和/或
目标属性操作。 $ b for target_link_libraries()讨论了一下,但是您必须去
挖掘它提到
的目标属性的文档才能了解什么情况,例如私人或
公共行为投放广告。

As a final note, if you call target_link_libraries() and do not specify any of PRIVATE, PUBLIC or INTERFACE, you may be tempted to believe that it will be treated as PUBLIC. The situation is actually more complicated than that though. It may be treated as PUBLIC or PRIVATE, depending on what other target_link_library() calls and/or target property manipulations have been performed. The documentation for target_link_libraries() talks a bit about this, but you have to go digging into the documentation for the target properties it mentions to get an understanding of what circumstances lead to PRIVATE or PUBLIC behaviour.

什么情况? (BTW。这句话的作者是Craig Scott,他似乎是SO的活跃用户,我相信他可以回答我...)

推荐答案

政策0023 表示 target_link_libraries 没有默认行为-每个项目都应使用全关键字调用此命令或无关键字:

Description of policy 0023 suggests, that there is no "default" behavior of target_link_libraries - every single project should have calls to this command either all-keyworded or none-keyworded:


纯文本关键字和关键字target_link_libraries签名不能混合使用。

Plain and keyword target_link_libraries signatures cannot be mixed.

这篇关于什么是默认的target_link_libraries隐私设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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