# how to automatically collect the created target?

**URL:** <https://discourse.cmake.org/t/how-to-automatically-collect-the-created-target/5868>\
**Category:** Code\
**Created:** [June 15, 2022, 3:39am UTC](https://discourse.cmake.org/t/how-to-automatically-collect-the-created-target/5868 "2022-06-15T03:39:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhang-qiang-github](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zhang-qiang-github/32/1913_2.png) [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Post date:** [June 15, 2022, 3:39am UTC](https://discourse.cmake.org/t/how-to-automatically-collect-the-created-target/5868/1 "2022-06-15T03:39:26Z")

</div>

I want to generate myself package using cmake, and a essential code is:

```auto
install(TARGETS packageA packgeB ...
    RUNTIME DESTINATION bin
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
)

```

The `packageA packageB ...` indicates the created target. Is there any method to automatically collect these created target? Does I must manually input the targets?

Any suggestion is appreciated~~~

---

<div class="post-metadata">

**Author:** ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Post date:** [June 15, 2022, 3:52am UTC](https://discourse.cmake.org/t/how-to-automatically-collect-the-created-target/5868/2 "2022-06-15T03:52:26Z")

</div>

You need to manually list the targets in install commands.

---

<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:** [June 18, 2022, 11:21am UTC](https://discourse.cmake.org/t/how-to-automatically-collect-the-created-target/5868/3 "2022-06-18T11:21:53Z")

</div>

You may try to use [GitHub - aminya/project\_options: A general-purpose CMake library that makes using CMake easier](https://github.com/aminya/project_options) the package\_project() Funktion
