Fix linking issues for cmake