# automoc

**URL:** https://discourse.cmake.org/t/automoc/3481
**Category:** Usage
**Created:** [June 3, 2021, 3:54pm UTC](https://discourse.cmake.org/t/automoc/3481 "2021-06-03T15:54:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Tomasz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tomasz/32/381_2.png) [@Tomasz](https://discourse.cmake.org/u/Tomasz)
#### Post date: [June 3, 2021, 3:54pm UTC](https://discourse.cmake.org/t/automoc/3481/1 "2021-06-03T15:54:01Z")

</div>

Hi

I have a question about qt signals in header file. In documentaion to cmake i read which file will be proccessed by auo-moc:

"For all C++ source files `<source_base>.<source_extension>` in the target’s sources, CMake searches for

- a regular header with the same base name (`<source_base>.<header_extention>`)"

Am I correct that two files, source and header must be in same directory.

---

<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: [June 3, 2021, 6:12pm UTC](https://discourse.cmake.org/t/automoc/3481/2 "2021-06-03T18:12:15Z")

</div>

I think if you don’t explicitly list headers, I imagine so. Having `automoc` search all over the place for a header doesn’t sound wise. If you add the headers to the target source list, that should also work (since removing the extension and adding a header extension would make the same path).

---

<div class="post-metadata">

### Author: ![Tomasz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tomasz/32/381_2.png) [@Tomasz](https://discourse.cmake.org/u/Tomasz)
#### Post date: [June 4, 2021, 5:56am UTC](https://discourse.cmake.org/t/automoc/3481/3 "2021-06-04T05:56:32Z")

</div>

It’s way a to add whole directory instead of listong all files?

---

<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: [June 4, 2021, 12:43pm UTC](https://discourse.cmake.org/t/automoc/3481/4 "2021-06-04T12:43:56Z")

</div>

Yes, but [I don’t recommend it in practice](https://discourse.cmake.org/t/is-glob-still-considered-harmful-with-configure-depends/808/2).
