Mosques and places of Prayer - Section 1 Mishkat al-Masabih 713

Arabic hadith text
وَعَن جُنْدُب قَالَ: سَمِعْتُ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ: «أَلَا وَإِنَّ مَنْ كَانَ قَبْلَكُمْ كَانُوا يَتَّخِذُونَ قُبُورَ أَنْبِيَائِهِمْ وَصَالِحِيهِمْ مَسَاجِدَ أَلَا فَلَا تَتَّخِذُوا الْقُبُورَ مَسَاجِدَ إِنِّي أَنْهَاكُمْ عَنْ ذَلِكَ» . رَوَاهُ مُسلم
Translation

Jundub told of his hearing the Prophet say, “Those who preceded you used to take the graves of their prophets and righteous men as mosques, but you must not take graves as mosques; I forbid you to do that.” Muslim transmitted it.