Cpp-Library and setting compiler args for variant

Hi,

I define a library using the CppLibraryPlugin:

plugins { 
    id "cpp-library"
}
...
library { 
      source.from files (
           ,,,
      )
}

What’s the best/optimal way of adding e.g. -DSOME_FLAG=1 to e.g. “Debug” variant?

If said library was to be compiled for e.g. client vs server (I need to add another Dimension?). How can I effectively do this? It should then produce serverDebug, serverRelease, clientDebug, clientRelease.