将我的共享库链接到另一个(CMAKE)
我目前正在尝试将我编写的 CXX 库链接到 VTK(一个 CMake 制作的库),最终创建一个具有我的代码功能并可以解析 VTK 中的符号的共享库。我需要共享最终结果,因为我需要在运行时用 Java 调用该库。
I'm currently trying to link a CXX library that I've written to a VTK, a CMake made library - to end up creating a shared library that has my code's functionality and can resolve the symbols from VTK. I need the end result to be shared because I'd need to call the library up at runtime in Java.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您需要使用 target_link_libraries,因此最小的 CMake 块可能看起来像这样,
这将添加一个名为 mylib(Linux 上的 libmylib.so)的共享库,该库链接到 vtkRendering(此处可以添加多个库)。查看“cmake --help-commands”以获取 CMake 命令的完整列表。
It sounds like you need to use target_link_libraries, so a minimal CMake block might look like,
This would add a shared library called mylib (libmylib.so on Linux), that links to vtkRendering (multiple libraries could be added here). Check out 'cmake --help-commands' for a full list of CMake commands.