Refactored MD generation CMakeLists.txt

Partially refactored md/CMakeFiles.txt, removed redundant targets for
the first part, the CF_MD_ENABLED section still don't work.