[CMake] Library numeric extension?

Michael Wild themiwi at gmail.com
Fri Jun 17 01:04:30 EDT 2011


On 06/16/2011 11:56 PM, David Doria wrote:
> I added a simple:
> 
> target_link_libraries(myprogram geotiff)
> 
> to my CMakeLists.txt file. I have a libgeotiff.so in a directory on my
> LD_LIBRARY_PATH. The code compiled, but when I tried to run it, I got
> an error that I was missing libgeotiff.so.2. I made a symlink from
> libgeotiff.so.2 to libgeotiff.so, and then everything worked. Why was
> this .2 introduced? Is there either 1) a way to stop it from getting
> introduced or 2) a way to tell it "just use the closest file" so it
> would use the libgeotiff.so without me needing to make a symlink?
> 
> Thanks,
> 
> David

This is not the fault of CMake. The file should actually be called
libgeotif.so.2, and the symlink should be called libgeotif.so and point
to libgeotif.so.2. The symlink is only used for linking, while the real
file, libgeotif.so.2, will be used at runtime. This is to make it
possible to have multiple versions of libgeotif installed, but only one
version will be used for linking.

See here for more info:
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

HTH

Michael


More information about the CMake mailing list