# Working with generated header files on Xcode

**URL:** https://discourse.cmake.org/t/working-with-generated-header-files-on-xcode/14457
**Category:** Usage
**Created:** [July 28, 2025, 2:06pm UTC](https://discourse.cmake.org/t/working-with-generated-header-files-on-xcode/14457 "2025-07-28T14:06:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SamCoutteauHybrid](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samcoutteauhybrid/32/5168_2.png) [@SamCoutteauHybrid](https://discourse.cmake.org/u/SamCoutteauHybrid)
#### Post date: [July 28, 2025, 2:06pm UTC](https://discourse.cmake.org/t/working-with-generated-header-files-on-xcode/14457/1 "2025-07-28T14:06:46Z")

</div>

I would like to generate some headers to be able to export some data as preprocessor defines (context: exporting a project such that it can be consumed by non cmake projects).

This is quite simple using `file(GENERATE)` and then add those file to a target using `target_sources(FILE_SET)`.

As some of the contents depends on `$<CONFIG>`, I put the generate files in seperate folders. ex.  
`config-$<CONFIG>/include/header.hpp` and also set the `BASE_DIRS` accordingly`

This all works fine except on Xcode where it expands `$<CONFIG>` to `NOCONFIG`.

I get that this is a limitation of Xcode, [XCode config generator expression becomes NOCONFIG](https://discourse.cmake.org/t/xcode-config-generator-expression-becomes-noconfig/4498).

But how can I achieve the desired result? I was using file sets to make installing the targets easier.

I would assume if I just loop over all the configs and add each file as a source I would loose the ability to install the header files based on config. I do believe include directories with `$<CONFIG>` does work on xcode. It seems like I would have to implement my own custom version of file sets to get this to work.
