如何使用CMake更新库路径?
我正在为 GNU/Linux 编写一个共享库,现在将使用“sudo make install”进行安装。我有 CMake 配方来创建文件并将它们安装在“/usr/local/lib/app”中,并且库和链接已正确创建。
但是库路径没有更新,我必须手动运行“sudo ldconfig /usr/local/lib/app”才能使库可用。
我系统上的其他几个软件包将它们的库放在 /usr/local/lib 下的特定文件夹中,所以我假设这是正确的。那么
如何让 CMake 更新系统的库路径以及创建文件并安装它们?
我也希望完成此操作,以便库能够完成。路径更新在系统重新启动后仍然存在,
谢谢, BCW
I am writing a shared library for GNU/Linux, which will install for now with "sudo make install". I have CMake recipes to create the files and install them in '/usr/local/lib/app', and the libraries and links are created correctly.
But the library path is not updated and I must run "sudo ldconfig /usr/local/lib/app' manually to make the library available.
Several other packages on my system put their libraries in a specific folder under /usr/local/lib, so I am assuming that's proper.
How then to have CMake update the library path for the system as well as create the files and install them? What is the proper way to do this?
I'd also like it accomplished so that the library path update survives a system restart.
Thanks,
bcw
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有任何特定于 CMake 的设施。但是,您应该能够添加如下规则以使更改持久存在。
当您覆盖
bret/lib{,64}
中的文件时,您仍然需要重新运行 ldconfig。I'm not aware of any CMake-specific facility. However, you should be able to add rules such as the following in order to make the change persistent.
You'll still need to re-run the ldconfig when you overwrite files in
bret/lib{,64}
.