# Proper way to install library with external dependencies ?

**URL:** <https://discourse.cmake.org/t/proper-way-to-install-library-with-external-dependencies/12992>\
**Category:** Code\
**Created:** [November 19, 2024, 7:10pm UTC](https://discourse.cmake.org/t/proper-way-to-install-library-with-external-dependencies/12992 "2024-11-19T19:10:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_Madden](https://discourse.cmake.org/user_avatar/discourse.cmake.org/timothy_madden/32/4211_2.png) [@Timothy\_Madden](https://discourse.cmake.org/u/Timothy_Madden)\
**Post date:** [November 19, 2024, 7:10pm UTC](https://discourse.cmake.org/t/proper-way-to-install-library-with-external-dependencies/12992/1 "2024-11-19T19:10:24Z")

</div>

Hello

My library (odbc++) has a public dependency on ODBC32.dll,

I can successfully use:

```cmake
find_library(ODBC_LIBRARY_PATH "ODBC32")
target_link_libraries(odbc++ PUBLIC "${ODBC_LIBRARY_PATH}")

```

and cmake would find the associated .lib file from the Windows SDK, and link with it.

But when I install and export `odbc++`, the config file emitted is very bad:

```cmake
set_target_properties(odbc++ PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/um/x64/odbc32.lib")

```

This is a hard-coded dependency on my local version of Windows SDK !

Why does CMake hard-code any library path at all in the export file ?

Is there a way to mark the library as a “SYSTEM” library, and instruct cmake to maybe use `find_library()` in the export file ?

I guess the more general question is how to export a library with “floating” dependencies, so the consuming project would try to locate them (with `find_package()` for example) ?

Sorry I feel I don’t know how to express this any better, I am sure such a scenario appeared many times before

–  
Thank you  
Timothy Madden
