Using conditional compilation in CPP files

I have a CPP file which put it directly next to my CS scripts. It’s used to bridge with some SDKs. But this file is only relevant for Switch console and I want to exclude this from being compiled in other platforms.

I tried wrapping the content of the file with #if UNITY_SWITCH macro which is accessible in CS scripts but it didn’t work. Seems we don’t have access to macros defined in Unity in the CPP files.

What would be the clean way to do this?