fix logic bug in cmake