# How to install a specific target for multiple projects by \`add\_subdirectory\`?

**URL:** <https://discourse.cmake.org/t/how-to-install-a-specific-target-for-multiple-projects-by-add-subdirectory/5099>\
**Category:** Code\
**Created:** [February 23, 2022, 3:07pm UTC](https://discourse.cmake.org/t/how-to-install-a-specific-target-for-multiple-projects-by-add-subdirectory/5099 "2022-02-23T15:07:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronald](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@Ronald](https://discourse.cmake.org/u/Ronald)\
**Post date:** [February 23, 2022, 3:07pm UTC](https://discourse.cmake.org/t/how-to-install-a-specific-target-for-multiple-projects-by-add-subdirectory/5099/1 "2022-02-23T15:07:31Z")

</div>

CMakeLists.txt

```cmake
add_subdirectory(App1)
add_subdirectory(App2)

```

Can the user choose to install only App1 and how?

---

<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:** [February 23, 2022, 3:38pm UTC](https://discourse.cmake.org/t/how-to-install-a-specific-target-for-multiple-projects-by-add-subdirectory/5099/2 "2022-02-23T15:38:44Z")

</div>

If the `COMPONENTS` argument is specified to the relevant `install()` commands, yes. Otherwise, the Makefile generator supports per-directory `install` targets, but no other generators do (AFAIK) by doing `make -C App1 install`. Note that per-directory installs may miss dependencies that need installed outside of that directory.
