.so with numerals after that, how to match them in find_library in cmake ? Error in linking shared objects which are found as sub-dependencies

£可爱£侵袭症+ 提交于 2019-12-06 02:00:24

Command find_library use CMAKE_FIND_LIBRARY_SUFFIXES and CMAKE_FIND_LIBRARY_PREFIXES variables to glue the real library name. For instance:

> cat CMakeLists.txt
message("suffixes: ${CMAKE_FIND_LIBRARY_SUFFIXES}")
message("prefixes: ${CMAKE_FIND_LIBRARY_PREFIXES}")
> cmake -H. -B_builds
suffixes: .so;.a
prefixes: lib

CMAKE_FIND_LIBRARY_SUFFIXES is a list variable and you can add a new suffix:

> cat CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.17)
find_library(library edata-book-1.2)
message("library: ${library}")
> cmake -H. -B_builds
library: /usr/lib/libedata-book-1.2.so.17

But I'm pretty sure that the real problem here is package manager usage (: Usually lib<name>.so is a symlink to lib<name>.so.N.M file. So I recommend you to check manuals and install your library in an appropriate way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!