# How to clear link libs added by LINK\_LIBRARIES()

**URL:** https://discourse.cmake.org/t/how-to-clear-link-libs-added-by-link-libraries/13098
**Category:** Usage
**Tags:** os:linux, gen:ninja
**Created:** [November 30, 2024, 1:12pm UTC](https://discourse.cmake.org/t/how-to-clear-link-libs-added-by-link-libraries/13098 "2024-11-30T13:12:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tntljc](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tntljc/32/5161_2.png) [@tntljc](https://discourse.cmake.org/u/tntljc)
#### Post date: [November 30, 2024, 1:12pm UTC](https://discourse.cmake.org/t/how-to-clear-link-libs-added-by-link-libraries/13098/1 "2024-11-30T13:12:22Z")

</div>

Basically my code look like this:

```auto
LINK_LIBRARIES(Foo)

add_library(StaticLib lib.cpp)

add_executable(Exe)

target_link_library(StaticLib)

set_target_properties(Exe PROPERTIES LINK_LIBRARIES "")

# ^^^^^ I called get_target_property() and confirmed that *Foo* is cleared from the property

```

But Foo still appeared at the end of the final link command. It seems CMake add what’s LINK\_LIBRARIES added twice in the link command.

Is it because Exe linked StaticLib and Foo is its dependency therefor is propagated to Exe? I suppose this shouldn’t be the case because LINK\_LIBRARY() won’t affect static library(?)

So any idea why this happened and how can I remove _Foo_ from the link command of _Exe_?
