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.
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.