# Is there a way to show an add\_subdirectory() compile failure from a long list of add\_subdirectory() instances?

**URL:** https://discourse.cmake.org/t/is-there-a-way-to-show-an-add-subdirectory-compile-failure-from-a-long-list-of-add-subdirectory-instances/3023
**Category:** Usage
**Tags:** os:windows
**Created:** [March 25, 2021, 7:41pm UTC](https://discourse.cmake.org/t/is-there-a-way-to-show-an-add-subdirectory-compile-failure-from-a-long-list-of-add-subdirectory-instances/3023 "2021-03-25T19:41:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![JRR](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@JRR](https://discourse.cmake.org/u/JRR)
#### Post date: [March 25, 2021, 7:41pm UTC](https://discourse.cmake.org/t/is-there-a-way-to-show-an-add-subdirectory-compile-failure-from-a-long-list-of-add-subdirectory-instances/3023/1 "2021-03-25T19:41:03Z")

</div>

My scenario is as follows.

I have an example folder with 20+ examples in it. Each example is separated into it’s own sub-folder with it’s own `CMakeLists.txt` file, source/include folder, etc.

```nohighlight
Examples
├───Ex1
│ ├───include
│ └───source
├───Ex2
│ ├───include
│ └───source
├───Ex3
│ ├───include
│ └───source
...
├───Ex20
│ ├───include
│ └───source
└───EX21
    ├───include
    └───source

```

  

I have a top level `CMakeLists.txt` file under `Examples`. That file is basically a bunch of `add_subdirectory()` calls to all the `Ex#` subdirectories.

  

I had a case where I ran

```auto
cmake --build .

```

The compile for Ex2 failed, but everything else succeeded. As anti-luck would have it I wasn’t watching the compile so I didn’t see the error message/failure scroll by.

Nothing in the final screen of output from the `cmake` command made me think that I had any failures earlier on, so I started to do next step action. Which eventually lead me to finding out that Ex2 actually failed to compile.

I know that I could have done the command

```nohighlight
echo %ERRORLEVEL%

```

after running `cmake --build .`, however that’s not really a common practice when working with the cli. It is for scripts, but not manual CLI interaction.

Is there a method, a pattern, or a practice that I can use so that `cmake` will display a summary or some indicate of a failure at the end?
