Per config pch/unity modes
Goal here is to have 3 configurations in a Ninja MultiConfig generator scenario.
Currently testing on windows, cmake 3.20.5 with presets and ninja-multi config build (ninja version 1.10.2), have not confirmed this same behavior on linux/mac with gcc/clang respectively.
Goal is that my 3 configure DebugCoverage/Release/Debug all can be built at once, each with differing UNITY_BUILD modes, and precompiled headers either enabled or not
Currently I have DebugCoverage mapped for imported targets to inherit the debug properties:
"CMAKE_CONFIGURATION_TYPES": "Debug;Release;DebugCoverage",
"CMAKE_DEFAULT_BUILD_TYPE": "Debug",
"CMAKE_MAP_IMPORTED_CONFIG_DEBUGCOVERAGE": ";DebugCoverage;Debug",
(A lot of this was to get integration with vcpkg just right)
So the use case is, now I can have one configuration pass that can spit-out 3 kinds of artifacts all at once, saves me a lot a build time, however I've not been able to quite get it to work though:
Example:
target_precompile_headers(${NAME} PRIVATE "$<$<NOT:$<CONFIG:DebugCoverage>>:${product/header.h}>"
Easier example (inverted, JUST my DebugCoverage config should have them right?)
target_precompile_headers(${NAME} PRIVATE "$<$<CONFIG:DebugCoverage>:${product/header.h}>")
Both cause a strange error
CMake Error: No output files for WriteBuild! called with comment: Additional output files.
Same goes for the UNITY_BUILD target property (I have not been able to confirm if this one even supports generator expressions)
Examples:
set_target_properties(${NAME} PROPERTIES UNITY_BUILD $<CONFIG:Release>)
set_target_properties(${NAME} PROPERTIES UNITY_BUILD $<$<CONFIG:Release>:1>)
Both don't seem to do anything but disables unity builds for all targets on all configs. I've toyed around with a bunch more but, gotta ask, is this even allowed here?