#define Based On Target

Greetings All,

not sure if this is the correct discussion group for the question, so please forgive me (first time post).

I am working on a project that I started in the normal Arduino software.

During development I realised that the code is almost 100% identical between the Client and Server Arduino and so I modified the code base to use #define COM_MODE to indicate which board I was sending the code into.

So when I made modifications to the code for either, I could just copy the script over the other and change this #define and voila! all working.

I am now a PlatformIO “first timer” and testing what I can do with it. I love the dual target option (upload to two boards at once) and am wondering if there is a way to notice which target I am uploading to and change this #define, or otherwise use that information to indicate which target I am using.

All help appreciated and sorry for the long first post.