Move -ltinfo, -lz, etc last in cmake build