I had envisaged one of these in the project preferences
TESTING
HOST
TARGET
My final implementation is to set BUILDOPT to 1 to enable the code, > 1 to disable. Then the #if becomes #if 1/BUILDOPT==1.