c++cmakebuildgenerator-expression

How to specify multiple configurations in a CMake CONFIG generator expression?


According to the documentation, the $<CONFIG:cfgs> generator expression evaluates to 1, if the current configuration is one of the entries in cfgs and 0 otherwise. But how do I add more than one configuration to the cfgs-list?

The following snippet generates an error ($<CONFIG> expression requires one or zero parameters.)

$<CONFIG:Debug,RelWithDebInfo>

I tried other separators but without any success. Did I miss something or is there a mistake in the documentation?

I know that I could do something like the following, but it would be easier to read if I could reduce the expression to something as above.

$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>

Thanks in advance. 🙂


Solution

  • Handling multiple configs in the $<CONFIG:cfg> generator expression has been introduced only recently with CMake 3.19. Versions before only accepted a single configuration argument to the generator expression.