This generates the various StartServer_Debug.cpp, StartServer_Release.cpp files and works on every generator (inluding multi config ones like Visual Studio) except XCode.
What can I then do to use generator expressions in source files for xcode?
If they evaluate to per-config values, you can’t.
The Xcode generator does not support per-config sources. IIRC, Xcode does not provide a simple and robust way to express them.
In some cases one can work around this by using per-config COMPILE_DEFINITIONS along with a source that uses preprocessor conditions to #include the source of the matching configuration.
I want the value $<TARGET_FILE:BeansServer> to be available in my script. Currently I use configure_file and generate for this.
Can I pass this via target_compile_definitions as a macro instead?
Will that work for Xcode and all other generators`