I am puzzled by the way in which the IDE handles the type of board in use. If I change the board for one of my sketches, it's also changed for all the others, even if they are already active on-screen (this is for Windows, I don't know if the same applies for other systems).
There's a file in each of the Arduino folders (in the 'debug' subfolder) called 'board.buildinfo' and this defines, in the first line, a board (e.g. "name=Arduino/Genuino Uno") and, further down, an mcu ("build.mcu=atmega328p"). But this file appears to be created when he project is created, and never changed afterwards, so I'm not sure I see the point of these entries.
There is a file in the user's appdata folder (AppData>Local>Arduino15), 'preferences.txt', which defines a board in the first line. This is what is used to determine the board type of any sketch loaded, regardless of what board the sketch was used for previously.
So, I'm just wondering why the info in the 'board.buildinfo' file isn't used. If it was, it would be much easier (and more logical?) for designers who have more than one type of board. And (although it might not be a common requirement) it seems impossible to have two sketches open at the same time with different target devices.