From: Rabbi Moshe Sofer
To: Rabbi Meir
The Chasam Sofer rules that stones from a demolished cemetery wall may be reused for a different communal building. He concludes that a protective surrounding wall does not qualify as an accessory of the dead at all, and further relies on the Rashba's principle of implied communal stipulation and the Yerushalmi's rule that items made for both the living and the dead are not forbidden for benefit.
Source: Shu"t Chasam Sofer YD §335