gpt4 book ai didi

c++ - 默认 target_link_libraries 隐私设置是什么?

转载 作者:行者123 更新时间:2023-12-02 03:51:15 26 4
gpt4 key购买 nike

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

我在 CMake 中添加了一行:

target_link_libraries(myTarget
libraryA
libraryB
)

但我不知道它是PRIVATE还是PUBLIC或者可能是INTERFACE。我检查documentation ,但我没有看到我的问题的答案:(

编辑:

我找到了sth :

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.

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

最佳答案

policy 0023的描述建议,target_link_libraries没有“默认”行为 - 每个项目都应该调用此命令,无论是全关键字还是无关键字:

Plain and keyword target_link_libraries signatures cannot be mixed.

关于c++ - 默认 target_link_libraries 隐私设置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51396608/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com