The Messenger of Allah commanded him to build the mosque of Ta'if in the place where the Taghuts used to be.
Sunan Ibn Majah Book 4, Hadith 9