We currently have a multi-platform, multi-compiler build for a C++ program based on a bunch of custom ad hoc scripts. I'm investigating switching over to Modern CMake (with "modern" used in the sense described here), and trying to do it in a "best practices" way as much as possible. (For example, doing so in a fashion which will work with all sorts of generator types.)
The issue I'm running into is that we have more build types (build modes? configuration types?) than just the standard Release/Debug/RelWithDebInfo/MinSizeRel. I'm wondering how to implement these with Modern CMake.
From what I can tell (e.g. from the FAQ), the "traditional" way to add new build modes would be to hardcode various variables with names containing the new mode name. I'm skeptical about this approach for several reasons. First off, the list of variables which need to be set is left rather unclear. Secondly, it looks like the Modern CMake approach is to attach compiler flags to targets, rather than messing with global settings, and I'm not sure how to square that with the build type globals. Lastly, given the hope to have things working in a multi-compiler/cross platform fashion, I'm a bit concerned that Release/Debug/etc. works "automagically" on multiple platforms/compilers, but the custom build modes seem to require hard coding things for a particular platform/compiler. I realize that some platform/compiler specific code may be unavoidable, but I'm hoping to minimize that to the extent possible, and do that robustly.
What's the recommended best practices "Modern CMake" way of creating custom build/configuration types/modes? Specifically one which is most extensible for use with multiple compilers and platforms, and works robustly with both multi-configuration and single-configuration generators?