I am working with the Visual Studio Generator. I created custom configuration types using -DCMAKE_CONFIGURATION_TYPES="Custom-1;Custom-2" when calling CMAKE. My CMAKELISTS.txt uses the config type like this:
Apparently not. I’m not aware of - being special in generator expressions… There may, however, be old assumptions/enforcements around configuration names lingering around (e.g., it is called RelWithDebInfo because old(?) Visual Studio would do “substr” matches instead of == matches and requesting Release could find any of Release, ReleaseMinimumSize, or ReleaseWithDebug depending on ordering).
The expression in the description is malformed, but I suspect that is just a typo in transcribing from your real project. You have a stray < in the middle. It should be:
I think the regular expression on this line is the reason hyphens in configuration names are not supported in generator expressions. Adding a hyphen to that regular expression allows your example to work (after fixing the malformed part mentioned above). I don’t know if that’s a safe change in general or whether other places also don’t support a hyphen in a config name. It probably needs a deeper analysis than I have the time to available to dedicate right now. Hopefully this gives enough clues to someone else who might be able to do a deeper analysis.
In general we expect configuration names to be valid C identifiers. This minimizes the chance that some tool or file format doesn’t handle them correctly.