Let $X$ be a (singular) projective variety, in other words something given by a collection of polynomial equations in $\mathbb CP^n$ or $\mathbb RP^n$. How can one prove it is a finite $CW$ complex?

Similar question: Suppose that $X$ affine (i.e. given by polynomial equations in $\mathbb C^n$, or $\mathbb R^n$). How can one prove its one point compactification is a finite $CW$ complex?

These questions are sequel to the discussions here:

For which classes of topological spaces Euler characteristics is defined?