# Debugging Targets Added

**URL:** <https://discourse.cmake.org/t/debugging-targets-added/1843>\
**Category:** Code\
**Created:** [September 14, 2020, 11:21pm UTC](https://discourse.cmake.org/t/debugging-targets-added/1843 "2020-09-14T23:21:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Some\_Guy](https://discourse.cmake.org/user_avatar/discourse.cmake.org/some_guy/32/827_2.png) [@Some\_Guy](https://discourse.cmake.org/u/Some_Guy)\
**Post date:** [September 14, 2020, 11:21pm UTC](https://discourse.cmake.org/t/debugging-targets-added/1843/1 "2020-09-14T23:21:05Z")

</div>

I am new to CMAKE and I have added a third party library, glfw. It compiles using ExternalProject\_Add. This ExternalProject\_Add apparently calls the CMake code for glfw and adds a new target to which I can link, but I only know this if I parse their code or if I run something like `cmake --build . --target help` from the CLI. I want to be able to debug this from within CMAKE, i.e. to either

1. Get a list of all known targets beforehand in a list. Do the same afterwards, then subtract and print out the extra or
2. Query the external project for targets which it provides.

I am unable to find help on either of these, please help.

---

<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:** [November 24, 2020, 11:24pm UTC](https://discourse.cmake.org/t/debugging-targets-added/1843/2 "2020-11-24T23:24:52Z")

</div>

There’s no way to get the list of targets in a build right now. Though I suppose you could use the [`file-api`](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html) could probably be used to extract out the information. Note that it won’t be available until the `gdal` project’s configure step is complete.
