# Exclude auto-generated source files from the build?

**URL:** https://discourse.cmake.org/t/exclude-auto-generated-source-files-from-the-build/4624
**Category:** Code
**Tags:** os:macos, gen:xcode
**Created:** [December 8, 2021, 2:27pm UTC](https://discourse.cmake.org/t/exclude-auto-generated-source-files-from-the-build/4624 "2021-12-08T14:27:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![amzh](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/e99b99/32.png) [@amzh](https://discourse.cmake.org/u/amzh)
#### Post date: [December 8, 2021, 2:27pm UTC](https://discourse.cmake.org/t/exclude-auto-generated-source-files-from-the-build/4624/1 "2021-12-08T14:27:19Z")

</div>

Hello,

during the project build I have files generated by an external python script, that script is used on both Windows and macOS. I need to exclude a certain file from the Xcode build.

Is there a way to do that via cmake or my only option would basically be editing the script generating the file?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [December 8, 2021, 3:35pm UTC](https://discourse.cmake.org/t/exclude-auto-generated-source-files-from-the-build/4624/2 "2021-12-08T15:35:45Z")

</div>

CMake only build the files you’ve listed as sources. In fact one has to go through a few hoops to get generated sources to be included.  
So unless you did something non-standard, you shouldn’t have the generated sources being built.

---

<div class="post-metadata">

### Author: ![amzh](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/e99b99/32.png) [@amzh](https://discourse.cmake.org/u/amzh)
#### Post date: [December 8, 2021, 3:37pm UTC](https://discourse.cmake.org/t/exclude-auto-generated-source-files-from-the-build/4624/3 "2021-12-08T15:37:21Z")

</div>

thanks for that info.

I found a proper way to edit them out though.
