better cmake implementation