# Does link scope have any effect for executables?

**URL:** https://discourse.cmake.org/t/does-link-scope-have-any-effect-for-executables/15835
**Category:** Code
**Created:** [September 16, 2026, 9:41am UTC](https://discourse.cmake.org/t/does-link-scope-have-any-effect-for-executables/15835 "2026-09-16T09:41:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Wallby](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@Wallby](https://discourse.cmake.org/u/Wallby)
#### Post date: [September 16, 2026, 9:41am UTC](https://discourse.cmake.org/t/does-link-scope-have-any-effect-for-executables/15835/1 "2026-09-16T09:41:48Z")

</div>

I’ve seen people write all of the following:

```cmake
target_link_libaries(example someLibrary)
target_link_libaries(example PRIVATE someLibrary)
target_link_libaries(example PUBLIC someLibrary)

```

Is there any difference between the first one and the others? You can’t link executables to anything right?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 16, 2026, 10:02pm UTC](https://discourse.cmake.org/t/does-link-scope-have-any-effect-for-executables/15835/2 "2026-09-16T22:02:05Z")

</div>

There are some less mainstream platforms where you can actually link to an executable. For those, `PUBLIC` can make sense. But in practice, unless that specific platform is what you’re targeting and you specifically want to take advantage of that pattern, I always recommend using `PRIVATE`. That communicates the generally intended relationship.

I also recommend always specifying the visibility (`PRIVATE`, `INTERFACE`, or `PUBLIC`). Much older CMake versions didn’t support the visibility keywords, but that was many years ago now. I sometimes think we should consider making the visibility keyword required, but that would be a noisy policy change for older projects.
