The one who builds a Masjid for the pleasure of Allah Almighty; Allah Almighty would build a house for him in paradise. (Sahih Muslim).
The beloved Rasool صَلَّى اللهُ عَلَيْهِ وَاٰلِه وَسَلَّم himself participated in the building of Masjid. The reward of building Masjid reaches to the person even after his demise