# How to selectively include source files according to universal binary architecture?

**URL:** <https://discourse.cmake.org/t/how-to-selectively-include-source-files-according-to-universal-binary-architecture/5138>\
**Category:** Code\
**Tags:** os:macos, gen:makefiles\
**Created:** [March 1, 2022, 8:02am UTC](https://discourse.cmake.org/t/how-to-selectively-include-source-files-according-to-universal-binary-architecture/5138 "2022-03-01T08:02:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangxi](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/y/c2a13f/32.png) [@yangxi](https://discourse.cmake.org/u/yangxi)\
**Post date:** [March 1, 2022, 8:02am UTC](https://discourse.cmake.org/t/how-to-selectively-include-source-files-according-to-universal-binary-architecture/5138/1 "2022-03-01T08:02:14Z")

</div>

I’m trying to compile my project into Mac universal binaries. However, some of the SDK source code I used only works for x86. How can I make these files only being compiled in x86 part? If there’s no way to do so, I have to edit all these SDK files to wrap them inside x86-specific macros.

---

<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:** [March 1, 2022, 1:23pm UTC](https://discourse.cmake.org/t/how-to-selectively-include-source-files-according-to-universal-binary-architecture/5138/2 "2022-03-01T13:23:47Z")

</div>

There are ` __x86_64__ ` and ` __aarch64__ ` preprocessor definitions you can check for.
