The chemical reactions and pathways involving CDP-diacylglycerol, CDP-1,2-diacylglycerol, a substance composed of diacylglycerol in glycosidic linkage with cytidine diphosphate. It is a common intermediate in phospholipid biosynthesis.