# Installing a dependent program created by custom command with EXCLUDE\_FROM\_ALL active

**URL:** https://discourse.cmake.org/t/installing-a-dependent-program-created-by-custom-command-with-exclude-from-all-active/10826
**Category:** Usage
**Created:** [May 9, 2024, 12:41pm UTC](https://discourse.cmake.org/t/installing-a-dependent-program-created-by-custom-command-with-exclude-from-all-active/10826 "2024-05-09T12:41:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Chardrazle](https://discourse.cmake.org/user_avatar/discourse.cmake.org/chardrazle/32/4362_2.png) [@Chardrazle](https://discourse.cmake.org/u/Chardrazle)
#### Post date: [May 9, 2024, 12:41pm UTC](https://discourse.cmake.org/t/installing-a-dependent-program-created-by-custom-command-with-exclude-from-all-active/10826/1 "2024-05-09T12:41:01Z")

</div>

This scenario has a target (static lib in the example) that acquires a dependent file via a custom command.  
The lib is not required by the “all” target, so that part of the source tree is brought in with `EXCLUDE_FROM_ALL` (which could be many layers deep, along with other targets).  
The lib target presents an `install` step for the output created via the custom command.  
The problem is that even though the lib target is referenced (by the example exe) and so is built, the `EXCLUDE_FROM_ALL` results in the `install` step being skipped.  
The link between the install and the target’s sources is not resolved.

Is there an alternative/better approach?

Example:  
[CMakeLists.txt](https://discourse.cmake.org/uploads/short-url/nt4iPAckLmxzvoM0N28a8xjUT9S.txt) (982 Bytes)

---

<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: [January 1, 2025, 10:41pm UTC](https://discourse.cmake.org/t/installing-a-dependent-program-created-by-custom-command-with-exclude-from-all-active/10826/2 "2025-01-01T22:41:16Z")

</div>

A related issue:

[https://gitlab.kitware.com/cmake/cmake/-/issues/26198](https://gitlab.kitware.com/cmake/cmake/-/issues/26198)

Probably worth its own issue though.
