Flags being targeted by Fight and area attack commands

We all know that flags also are targeted with area attack commands. Maybe someone could create a new widget.

If there is a flag, supply depot or a building closer than the enemy infantry, your infantry, with fight commands, will target thoose before the enemy infantry.
With buildings and supply depots it is not really a problem because they can’t move and it can be countered with infantry but it is annoying with flags since it needs extra attention and micro to avoid infantry running towards the enemy flags before firing staying stationary to fire.
Anyone got a good idea?