# What is the default target when building a project?

**URL:** https://discourse.cmake.org/t/what-is-the-default-target-when-building-a-project/2341
**Category:** Usage
**Created:** [December 10, 2020, 7:35pm UTC](https://discourse.cmake.org/t/what-is-the-default-target-when-building-a-project/2341 "2020-12-10T19:35:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [December 10, 2020, 7:35pm UTC](https://discourse.cmake.org/t/what-is-the-default-target-when-building-a-project/2341/1 "2020-12-10T19:35:07Z")

</div>

[https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project](https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project)

Looking at the cmake build documentation I’m a bit confused.

```auto
--target <tgt>..., -t <tgt>...

    Build <tgt> instead of the default target. Multiple targets may be given, separated by spaces.

```

What is the default target? Can I query for it? Can we add extra docs?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [December 11, 2020, 6:43am UTC](https://discourse.cmake.org/t/what-is-the-default-target-when-building-a-project/2341/2 "2020-12-11T06:43:15Z")

</div>

If I’m not mistaken, it’s simply “all”.

---

<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: [December 11, 2020, 11:05am UTC](https://discourse.cmake.org/t/what-is-the-default-target-when-building-a-project/2341/3 "2020-12-11T11:05:10Z")

</div>

For Makefile and Ninja generators at least, yes it is `all`, but for other generators it is called `ALL_BUILD` (not sure if any use `ALL` off the top of my head).

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [December 11, 2020, 6:41pm UTC](https://discourse.cmake.org/t/what-is-the-default-target-when-building-a-project/2341/4 "2020-12-11T18:41:43Z")

</div>

@craig.scott where is this documented by the way?

I swear I read this somewhere but I can’t find it in the cmake docs for the life of me.

---

<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: [December 11, 2020, 8:27pm UTC](https://discourse.cmake.org/t/what-is-the-default-target-when-building-a-project/2341/5 "2020-12-11T20:27:07Z")

</div>

A quick grep shows that it is mentioned at least in the following places:

- [https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#selecting-a-target](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#selecting-a-target)
- [https://cmake.org/cmake/help/latest/command/ctest\_build.html](https://cmake.org/cmake/help/latest/command/ctest_build.html) (see the TARGET item, although I now see it needs to be updated to mention Xcode as well)
- [https://cmake.org/cmake/help/latest/command/try\_compile.html#try-compiling-whole-projects](https://cmake.org/cmake/help/latest/command/try_compile.html#try-compiling-whole-projects)
