First refactoring of CMake files; need to fix bgurls++