I have a large library of my own with many components or "submodules" (similarly to how boost has many components) which I am setting up install rules for within CMake.

Let's say my library is called myLib version 1.2.3. My question is, since my library will produce many .a or .so output files due to the several components, is it acceptable to install these files into a subfolder within /usr/local/lib/ e.g. into /usr/local/lib/myLib/ or /usr/local/lib/myLib-1.2.3/?

I am usually a Windows developer but am dual-booting Ubuntu and want installation of my library for other developers on Unix to be as hassle-free as possible.

I noticed the libboost-all-dev installs all files directly into /usr/local/lib/, however I see that this can make the lib folder quite messy. Does it matter if I "add clutter" to this folder with many library files?

Also, I am contemplating whether my library files should have the version in the title. What is the standard for this? e.g. myLib-1.2.3.a vs myLib.a. I know this is slightly off-topic to the main question, but if I install directly to the lib folder, then it might be advantageous to have version numbers in the file etc. so I think it is slightly related.

Also - apologies if this is the wrong thread, as I know it is heavily related to software engineering, but I assumed it had more to do with Linux folder structure than anything else!

1 Answer 1


If you wish to install libraries anywhere other than the system lib directories, and for other users to access them, then create a text file in /etc/ld.so.conf.d/ which contains the directory where you are placing your libs, then run ldconfig. The system will then correctly pick your libs, provided there are no clashes. There is no requirement to mess around with compiler & linker settings other than supplying -l/-L settings to compiler/linker.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .