Fixed inconsistent includes, and link errors in cmake script