Compute $\int_0^{\pi/2}\frac{\cos{x}}{2-\sin{2x}}dx$ How can I evaluate the following integral?

$$I=\int_0^{\pi/2}\frac{\cos{x}}{2-\sin{2x}}dx$$  


I tried it with Wolfram Alpha, it gave me a numerical solution: $0.785398$.
Although I immediately know that it is equal to $\pi /4$, I fail to obtain the answer with pen and paper.
I tried to use substitution $u=\tan{x}$, but I failed because the upper limit of the integral is $\pi/2$ and $\tan{\pi/2}$ is undefined.
So how are we going to evaluate this integral? Thanks.

Here is a step by step approach. :)
$$\begin{align}
I &= \int_0^{\pi/2}\frac{\cos{x}}{2-\sin{2x}}dx \\
&= \int_0^{\pi/2}\frac{\cos{x}}{2-2 \sin x \cos x}dx \\
&= \int_0^{\pi/2}\frac{\cos{x}}{1+\cos^2 x -2 \sin x \cos x + \sin^2 x}dx \\
&= \int_0^{\pi/2}\frac{\cos{x}}{1+(\cos x - \sin x)^2}dx \\
&= \frac{1}{2} \left( \int_0^{\pi/2}\frac{\cos{x}}{1+(\cos x - \sin x)^2}dx + \int_0^{\pi/2}\frac{\sin{x}}{1+(\cos x - \sin x)^2}dx \right) \\
&= \frac{1}{2} \int_0^{\pi/2}\frac{\cos{x} + \sin{x}}{1+(\cos x - \sin x)^2}dx \\
&= -\frac{1}{2} \int_0^{\pi/2}\frac{d(\cos{x} - \sin{x})}{1+(\cos x - \sin x)^2}\\
&= -\frac{1}{2}\arctan(\cos{x}-\sin{x})|_{0}^{\frac{\pi}{2}} \\
&= \frac{\pi}{4}
\end{align}$$
