What is well-known to the scholars, and it is the position of the vast majority of them, so it can be considered like ijmaa' (a scholarly consensus) of the scholars of the early As-Salaf As-Saalih, is that zakaah is not to be used for building masjids, buying books, or the likes. It may only be distributed to the eight kinds of recipients that are mentioned in the verse in Soorah At-Tawbah [v.60], and they are:
(1) the fuqaraa' (those who are extremely poor),
(2) the masaakeen (the poor and needy),
(3) those who work in distributing it,
(4) those whose hearts are inclinded towards Islaam,
(5) freeing slaves,
(6) paying debts,
(7) in the way of Allaah, and
(8) the traveler who is in need.
And the phrase "in the way of Allaah" means jihaad specifically. This is what is known to the people of knowledge, and the building of masjids is not mentioned here, nor is the building of schools or roadways, nor their likes. And Allaah is the One who grants success.