# How to use the same name for a target and a library

**URL:** https://discourse.cmake.org/t/how-to-use-the-same-name-for-a-target-and-a-library/5044
**Category:** Code
**Created:** [February 17, 2022, 5:19pm UTC](https://discourse.cmake.org/t/how-to-use-the-same-name-for-a-target-and-a-library/5044 "2022-02-17T17:19:42Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [February 17, 2022, 5:36pm UTC](https://discourse.cmake.org/t/how-to-use-the-same-name-for-a-target-and-a-library/5044/2 "2022-02-17T17:36:26Z")

</div>

You can set [`OUTPUT_NAME`](https://cmake.org/cmake/help/latest/prop_tgt/OUTPUT_NAME.html) on a target to modify its basename. So:

```cmake
add_library(foobar)
add_executable(foobar_exe)
set_property(TARGET foobar_exe PROPERTY OUTPUT_NAME foobar)

```

---

_[View the full topic](https://discourse.cmake.org/t/how-to-use-the-same-name-for-a-target-and-a-library/5044)._
