Is it possible to make keyword change pragma setting in individual .cpp

I am currently testing both px4fmu-v2 and crazyflie configurations.
In some driver files they need different setup per each configuration and had to be manually setup by pragma setting.
For example #ifdef PX4FMU_V2 #else CRAZYFLIE #endif
Whenever switch from one another I had to change every files.
Is there a way to automatically set pragma setting for different make configuration?

it is not common to check on the hardware version in the driver. For SPI it’s a bit more complicated that i2c because you cannot simply scan all busses. I added fmu-v5 to the pmw3901 in this pr: https://github.com/PX4/Firmware/pull/10750. If you let me know what SPI bus and what SPI device you are using on fmu-v2 we can try to add it there (hopefully not overflowing the flash on that board).