# \_autogen "targets" setting the folder property

**URL:** https://discourse.cmake.org/t/autogen-targets-setting-the-folder-property/15598
**Category:** Code
**Created:** [April 8, 2026, 10:42pm UTC](https://discourse.cmake.org/t/autogen-targets-setting-the-folder-property/15598 "2026-04-08T22:42:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![scottaronbloom](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@scottaronbloom](https://discourse.cmake.org/u/scottaronbloom)
#### Post date: [April 8, 2026, 10:42pm UTC](https://discourse.cmake.org/t/autogen-targets-setting-the-folder-property/15598/1 "2026-04-08T22:42:12Z")

</div>

Running CMake 4.3 + Qt 6.11 and Im running into a problem with folders.

I already have a function that starts at the CMAKE\_SOURCE\_DIR finds every subdirectory via the SUBDIRECTORIES property, and sets the folder property appropriately.

However, there are a number of targets that seem to not be associated with a directory. \_autogen is the primary one.

When I try to explicitly set the folder for the target, cmake reports an error that the target does not exist.

I run the function, and explicit call to set the property in a DEFER call on CMAKE\_SOURCE\_DIR and it runs last.

Is there anyway to set the folder on the \_autogen targets?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [April 9, 2026, 9:36pm UTC](https://discourse.cmake.org/t/autogen-targets-setting-the-folder-property/15598/2 "2026-04-09T21:36:44Z")

</div>

Does the [`AUTOGEN_TARGETS_FOLDER`](https://cmake.org/cmake/help/latest/prop_gbl/AUTOGEN_TARGETS_FOLDER.html) global property do what you want?

---

<div class="post-metadata">

### Author: ![scottaronbloom](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@scottaronbloom](https://discourse.cmake.org/u/scottaronbloom)
#### Post date: [April 9, 2026, 11:51pm UTC](https://discourse.cmake.org/t/autogen-targets-setting-the-folder-property/15598/3 "2026-04-09T23:51:43Z")

</div>

No. I have tried it. All it does is create 1 target that is dependent on all the others. It simply create another target in the VS IDE
