cmak
September 28, 2021, 3:02pm
1
How to find a library (find_library
) and all associated symlinks to that library? E.g. a library typically looks like
libfoo.so
libfoo.so.1
libfoo.so.1.0.0
where the latter two are symlinks. Is there a better way than stating a find_library
3 times?
hsattler
(Hendrik Sattler)
September 28, 2021, 6:16pm
2
When you found the .so, you can resolve the symlink to get the .so.1.0.0 and then read the name that ld will use from the ELF headers.
At least that will be more consistent than 3 find_library calls
cmak
September 29, 2021, 9:48am
3
Not sure I understand how do that with cmake. Typically it would look like this;
libfoo.so -> libfoo.so.1.0.0*
libfoo.so.1 -> libfoo.so.1.0.0*
libfoo.so.1.0.0*
Finding libfoo.so
is easy. Some libraries are installed with one symlink, other with two symlinks. Also I want to install the symlink and not a copy of the symlink.
hsattler
(Hendrik Sattler)
September 29, 2021, 3:25pm
4
What exactly do you want to achieve? Maybe there’s a simpler way…
ben.boeckel
(Ben Boeckel (Kitware))
September 29, 2021, 5:47pm
5
Probably not as efficient as what you’re looking for, but find -L $dirname -maxdepth 1 -samefile $libname.so
should at least get the same answer.
cmak
September 30, 2021, 6:33am
6
I have a target baz
that links against library foo
in the toolchain sysroot. Now I want to install the foo
library to CMAKE_INSTALL_PREFIX
.
ben.boeckel
(Ben Boeckel (Kitware))
October 1, 2021, 11:35am
7
1 Like