Major changes in the cmake code. Start using more advanced cmake functions and avoid using the ones from other projects. Still some cleaning to do