当两个子目录引用同一库时,如何正确编写cmake文件?
我有这样的目录结构
external/
loglib/
subdir1/
CMakeList.txt // link with loglib
subdir2/
CMakeList.txt // link with loglib , the same loglib.
main.cc
CMakeList.txt // link with subdir1 subdir2 as if they are isolated libs
将loglib
因此而重复?这样做的最佳做法是什么?我是否应该将功能仅在主cmakefile下(只能链接loglib
一次),然后忘记诸如addSubDirectory之类的隔离?
I have a directory structure like this
external/
loglib/
subdir1/
CMakeList.txt // link with loglib
subdir2/
CMakeList.txt // link with loglib , the same loglib.
main.cc
CMakeList.txt // link with subdir1 subdir2 as if they are isolated libs
will loglib
be duplicated as a consequence of this? what's the best practice to do this? should i just combine the functionality under the main CMakefile (which will only link loglib
once ) and forget about isolation such as addsubdirectory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论