refactoring cmake to build all dependencies