Sayyiduna Ubayy bin Ka'b (may Allah be pleased with him) narrates this saying of the Prophet (peace and blessings be upon him): "The mosque whose foundation was laid on piety (taqwa) means this mosque of mine."
Ahmad recorded it; its chain contains a narrator, Abdullah bin Amir al-Aslami, who is da'if (weak).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الحج / 5895