cmake: fix linking issues