Hands down, my vote goes to the Beretta PX4 Storm.
It is the very best platform for the .40 s&w IMO. It's light, but not too light. Versatile ergo's due to the interchangeable backstraps, and different safety/decocker and action types.
The rotating barrel system really makes the difference when it comes to shooting the ever snappy .40 round from a polymer framed pistol. It's a kitten to shoot.
In fact, I've never even heard of anyone who bought one and didn't like it.
I assume you are looking at polymers since you mentioned the XDm, but if you are looking for metal frames, I think CZ makes some really great guns in .40 s&w.