How to specify library dir for imported interface?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to specify library dir for imported interface?

Francis Giraldeau
Build fails at link time, because a static library imported using pkg-config is not in the standard path: 

[ 74%] Linking CXX executable valhalla_add_predicted_traffic
/usr/bin/c++   ... -lprime_server ...

Usually, cmake uses the absolute path to the static library, but instead, pkg-config provides the library name and the library dir separately. Here is the imported target:

add_library(libprime_server INTERFACE IMPORTED)
pkg_check_modules(libprime_server REQUIRED libprime_server>=0.6.3)
set_target_properties(libprime_server PROPERTIES

The library dir is defined in the CMakeCache.txt (both in the LDFLAGS in LIBRARY_DIRS): 


However, it seems no property exists to actually specify the library dir of imported target, nor the linker flags to pass when using the imported target.

What would be the best way to specify the library dir for an imported library?


Francis Giraldeau
Francis Giraldeau


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: