This paper investigates intelligent reflecting surface (IRS) enabled non-line-of-sight (NLoS) wireless sensing, in which an IRS is dedicatedly deployed to assist an access point (AP) to sense a target at its NLoS region. It is assumed that the AP is equipped with multiple antennas and the IRS is equipped with a uniform linear array. We consider two types of target models, namely the point and extended targets, for which the AP aims to estimate the target's direction-of-arrival (DoA) and the target response matrix with respect to the IRS, respectively, based on the echo signals from the AP-IRS-target-IRS-AP link. Under this setup, we jointly design the transmit beamforming at the AP and the reflective beamforming at the IRS to minimize the Cram\'er-Rao bound (CRB) on the estimation error. Towards this end, we first obtain the CRB expressions for the two target models in closed form. It is shown that in the point target case, the CRB for estimating the DoA depends on both the transmit and reflective beamformers; while in the extended target case, the CRB for estimating the target response matrix only depends on the transmit beamformers. Next, for the point target case, we optimize the joint beamforming design to minimize the CRB, via alternating optimization, semi-definite relaxation, and successive convex approximation. For the extended target case, we obtain the optimal transmit beamforming solution to minimize the CRB in closed form. Finally, numerical results show that for both cases, the proposed designs based on CRB minimization achieve improved sensing performance in terms of mean squared error, as compared to other traditional schemes.