I'm developing a simple C shared library for my university using Cmake. At the moment I'm developing the install procedure of my *.so and my .*h files.
Where should I put the so and the header files when the user runs the famous sudo make install
?
From what I understand:
/usr/lib
and /usr/include
since those folders are reserved for distribution packages; /lib
and /include
since those folders are reserved for OS boot packages;That leaves me with usr/local/lib
and /usr/local/include
. However I can't decide whether or not I should put my files in a subfolder:
usr/local/lib
and /usr/local/include
will make them directly available in the system but they will remain unorganized with all the other files in the folders. More disturbing fact is that if someone installs another shared library whose header has the same name of mine, unknown behaviours may happen;/usr/local/lib/myAwesomeProject/
and /usr/local/include/myAwesomeProject
) will avoid the behaviours above, but will prevent the system to automatically detect my libraries (from what I understand the system automatically looks for include and library only in specific directories non-recursively): so if the system looks into /usr/local/include
, my includes won't be found because of the subfolder!To help you, here's my system:
Thanks for any kind reply!
/usr/local/lib
(otherwise linker will unable to find them) but may place headers under subfolder of /usr/local/include
(so them will not be mixed with headers from other libraries).– Tsyvarev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With