# Set default target for project(SomePorject NONE) project

**URL:** https://discourse.cmake.org/t/set-default-target-for-project-someporject-none-project/2132
**Category:** Usage
**Tags:** os:linux
**Created:** [November 6, 2020, 10:14am UTC](https://discourse.cmake.org/t/set-default-target-for-project-someporject-none-project/2132 "2020-11-06T10:14:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anon64994923](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@anon64994923](https://discourse.cmake.org/u/anon64994923)
#### Post date: [November 6, 2020, 10:14am UTC](https://discourse.cmake.org/t/set-default-target-for-project-someporject-none-project/2132/1 "2020-11-06T10:14:23Z")

</div>

Hi!

I am using cmake not to build something, but to generate some Makefile with bunch of tatrgets.  
So I do not have any executable, or library, but I have a lot of `add_custom_target`s with a lot of `if`s

It works well for me.

The only thing that I did not manage to, is to set one of the target as “default”, so I can just run make after generating, and get one of my target processed.

Let’s say I have

add\_custom\_target(target\_A)  
add\_custom\_target(target\_B)  
add\_custom\_target(target\_A1)  
add\_custom\_target(target\_A2)  
add\_dependencies(target\_A target\_A1)  
add\_dependencies(target\_A target\_A2)

And have some commands added to these target.

How can I have target\_A being executed when I issue make command after generation?

All solutions I’ve googeled, advises to do use add\_library somehow, but I have no real library in my case… What is the solution in this case?

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [November 6, 2020, 10:18am UTC](https://discourse.cmake.org/t/set-default-target-for-project-someporject-none-project/2132/2 "2020-11-06T10:18:00Z")

</div>

Use option `ALL` to include any custom target as part of `all` default target.

---

<div class="post-metadata">

### Author: ![anon64994923](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@anon64994923](https://discourse.cmake.org/u/anon64994923)
#### Post date: [November 6, 2020, 10:26am UTC](https://discourse.cmake.org/t/set-default-target-for-project-someporject-none-project/2132/3 "2020-11-06T10:26:27Z")

</div>

That worked. Thanks for quick answer

---

<div class="post-metadata">

### Author: ![Xavier\_Chen](https://discourse.cmake.org/user_avatar/discourse.cmake.org/xavier_chen/32/5393_2.png) [@Xavier\_Chen](https://discourse.cmake.org/u/Xavier_Chen)
#### Post date: [March 8, 2025, 10:53pm UTC](https://discourse.cmake.org/t/set-default-target-for-project-someporject-none-project/2132/4 "2025-03-08T22:53:32Z")

</div>

Hi, is it possible to clarify what do yo mean by use option ALL to include any custom target as part of all default target?

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [March 10, 2025, 11:24am UTC](https://discourse.cmake.org/t/set-default-target-for-project-someporject-none-project/2132/5 "2025-03-10T11:24:48Z")

</div>

Add the `ALL` argument to `add_custom_target()`, as per its [docs](https://cmake.org/cmake/help/latest/command/add_custom_target.html):

```auto
add_custom_target(Whatever ALL ...)

```
