try:

#ifdef ARDUINO_M5Stack-Core-ESP32

as is declared in arduino boards:
https://github.com/espressif/arduino-esp32/blob/master/boards.txt#L1169
but this is temporary solution because hyphens are not valid for arduino.

We waiting for some changes...
"issue" is added: https://github.com/m5stack/M5Stack/issues/41