Improve cmake
Change mistaken ifdefs
Apply appropriate definitions in cmake