Added missing cmake macros plus minor fixes