0

Linking a debian shared package library from an external location

I have a cmake project where I want to use the ALSA library, but I can't download the library directly so I have kept my ALSA library files in a folder /libraries/lib for so files and libraries/inc for header files.

In the CMakeLists file I added

include_directories(~/libraries/inc)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/bin;~/libraries/inc)

While trying to link the libraries I get the error can't find -lasound.Someone told me to use LDLIBS and LDFLAGS but I don't know how to. How do I link my libraries properly?

Q Tw
  • 21
  • 1
  • 3
  • Link directories could be specified with `link_directories` or `target_link_directories` command. But there is a better way for specify external library in CMake: using `add_library(IMPORTED)` command. See [duplicate question](https://stackoverflow.com/questions/8774593/cmake-link-to-external-library) for more information about possible solutions. – Tsyvarev May 30 '23 at 12:54

0 Answers0