cmake: fix bug #130

@memmett Could you test this whether it fixes #130 for you?