Bryan Singer's X-Men, X2, and Matthew Vaughn's X-Men First Class are far superior films to the Avengers.
They have better filmed action, better music, better drama, and more fleshed-out plot. I am surprised at the level of praise this film achieved, particularly towards Joss Whedon, when this film was so fast-paced and lighthearted, despite themes of global warfare.
This film was fun, but it felt very rushed and I don't think any of the characters got their due.
I also am not a big fan of SHIELD and do not understand their appeal.
X2 is my favorite CBM, hands down. I also really enjoyed the first one, but it suffered from budget constraints.
First Class worked very well when it was about Erik and Charles. It was terrible as an ensemble piece about the first class of mutants. Two great characters were trapped in a Glee episode.
I'd say X2 > Avengers > X-Men > First Class
And extended to include the other films in both series,
X2 > Iron Man > Avengers > Captain America > X-Men > The Incredible Hulk > Thor > First Class > Iron Man 2 > X-Men Origins: Wolverine > The Last Stand
From my opinion anyway.
And by general consensus, 100% of the MCU films have been 'good.' 60% of the X-Men films have been 'good.'
I still put Iron Man, X2, and SM2 over Avengers.
Which is no slight to The Avengers, it's just that The Avengers isn't supposed to be anything more than what it is.
That being, a reason to see all our heroes together kicking ass. Not a lot of substance there, but there doesn't need to be any. It's purely about entertainment, and it succeeds wonderfully.
The Glee comment about FC is spot on. Anytime Angel was in the air with her wings shooting spitballs, it looked completely ridiculous and took me out of the movie. But McAvoy and Fassbender were more than enough to save it imo.
X2 would have been a great film if it wasn't too centered on Wolverine. In fact, the whole Wolverine focus is what's dragging down the X-men movies.