The Compact Muon Solenoid experiment at the Large Hadron Collider at CERN includes a silicon pixel detector as its innermost component. Its main task is the precise reconstruction of charged particles close to the primary interaction vertex. This paper gives an overview of the mechanical requirements and design choices for the barrel pixel detector. The distribution of material in the detector as well as its description in the Monte Carlo simulation are discussed in detail.