# Listing available targets with cmake ?

**URL:** https://discourse.cmake.org/t/listing-available-targets-with-cmake/10855
**Category:** Usage
**Created:** [May 14, 2024, 8:52pm UTC](https://discourse.cmake.org/t/listing-available-targets-with-cmake/10855 "2024-05-14T20:52:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![neundorf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neundorf/32/2075_2.png) [@neundorf](https://discourse.cmake.org/u/neundorf)
#### Post date: [May 14, 2024, 8:52pm UTC](https://discourse.cmake.org/t/listing-available-targets-with-cmake/10855/1 "2024-05-14T20:52:09Z")

</div>

Hi,

I can use cmake from the command line to configure a project, to build it and to install it.  
But is there a way to list all buildable targets ?  
When using makefiles, I can do “make help”, with ninja I can do “ninja -t targets all”.  
But is there something generic like “cmake --list-targets” ?

Otherwise it’s kind of hard to find the name of the target to build with “cmake --build . --target foo”

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [May 15, 2024, 7:12pm UTC](https://discourse.cmake.org/t/listing-available-targets-with-cmake/10855/2 "2024-05-15T19:12:10Z")

</div>

`cmake --build . --target help` works always or not?

---

<div class="post-metadata">

### Author: ![neundorf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neundorf/32/2075_2.png) [@neundorf](https://discourse.cmake.org/u/neundorf)
#### Post date: [May 17, 2024, 8:24pm UTC](https://discourse.cmake.org/t/listing-available-targets-with-cmake/10855/3 "2024-05-17T20:24:14Z")

</div>

When using the Visual Studio generator it doesn’t work, it complains there is no such project file.

---

<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: [March 4, 2025, 9:18am UTC](https://discourse.cmake.org/t/listing-available-targets-with-cmake/10855/4 "2025-03-04T09:18:45Z")

</div>

Maybe some `find`-based command that finds VS project files? But a `help` target could probably be added to the VS generator.
