# Why does cmake not have a \`--run option\` , or does it?

**URL:** https://discourse.cmake.org/t/why-does-cmake-not-have-a-run-option-or-does-it/15661
**Category:** Usage
**Created:** [May 23, 2026, 8:25am UTC](https://discourse.cmake.org/t/why-does-cmake-not-have-a-run-option-or-does-it/15661 "2026-05-23T08:25:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![a4z](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/958977/32.png) [@a4z](https://discourse.cmake.org/u/a4z)
#### Post date: [May 23, 2026, 8:25am UTC](https://discourse.cmake.org/t/why-does-cmake-not-have-a-run-option-or-does-it/15661/1 "2026-05-23T08:25:44Z")

</div>

Can we have something like this, please

```auto

cmake --run --preset brewgcc –target hello

```

to run the add\_executable with the name hello

or do we have that already?

---

<div class="post-metadata">

### Author: ![a4z](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/958977/32.png) [@a4z](https://discourse.cmake.org/u/a4z)
#### Post date: [May 23, 2026, 8:49am UTC](https://discourse.cmake.org/t/why-does-cmake-not-have-a-run-option-or-does-it/15661/2 "2026-05-23T08:49:27Z")

</div>

ok, its not that hard to add a target run-${target} with a wrapper around add\_executable, but why do I have to do that?

---

<div class="post-metadata">

### Author: ![a4z](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/958977/32.png) [@a4z](https://discourse.cmake.org/u/a4z)
#### Post date: [May 23, 2026, 10:21am UTC](https://discourse.cmake.org/t/why-does-cmake-not-have-a-run-option-or-does-it/15661/3 "2026-05-23T10:21:58Z")

</div>

if there are better ways, please let me know

> **[Run CMake executable targets via CMake](https://a4z.noexcept.dev/blog/2026/05/23/CMake-Run-Targets.html)**
>
> A tiny CMake helper that builds a source file and adds a matching run-target for it.
