3

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

Bret
  • 136
  • 2
  • 5

1 Answers1

1

I'd also like it accomplished so that the library path update survives a system restart.

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.

echo "/usr/local/bret/lib" > /etc/ld.so.conf.d/bret-i386.conf
echo "/usr/local/bret/lib64" > /etc/ld.so.conf.d/bret-x86_64.conf
/sbin/ldconfig

You'll still need to re-run the ldconfig when you overwrite files in bret/lib{,64}.

Brian Cain
  • 14,403
  • 3
  • 50
  • 88