Refactor CMakeLists.txt