refactored cmake files to make it easier to set compiler flags