# How to describe runtime library dependency

**URL:** https://discourse.cmake.org/t/how-to-describe-runtime-library-dependency/10727
**Category:** Usage
**Created:** [April 23, 2024, 8:05pm UTC](https://discourse.cmake.org/t/how-to-describe-runtime-library-dependency/10727 "2024-04-23T20:05:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![AndreasSchacherbauer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/andreasschacherbauer/32/4530_2.png) [@AndreasSchacherbauer](https://discourse.cmake.org/u/AndreasSchacherbauer)
#### Post date: [April 23, 2024, 8:05pm UTC](https://discourse.cmake.org/t/how-to-describe-runtime-library-dependency/10727/1 "2024-04-23T20:05:04Z")

</div>

Hi!  
In order to use ASAN for our tests, we need to preload a library that defines a no op for dl\_close.

My question is now, how do I describe the dependency to this library in CMake best? We have a CMake function that we use to define a test. This defines a executable which is then registered to ctest through Gtest. As I could run any test, the dependency to this no op library needs to be defined in this Cmake function. Is add\_dependency the right choice? To build this no op library, we thought of having an additional cmake project to separate dependencies.

Thx for your input!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 9, 2024, 10:09pm UTC](https://discourse.cmake.org/t/how-to-describe-runtime-library-dependency/10727/2 "2024-05-09T22:09:25Z")

</div>

Since it sounds like purely a runtime thing, `add_dependencies` sounds like the way to go.
