The ideal is to solve the problem with carrot and stick.
Give them free housing of a sort, so that it’s an improvement over living on the street, but not so that currently-housed people would feel tempted to downgrade their status to homeless in order to get the free house.
The ideal free housing camp is (a) away from major population centres, (b) fairly basic, and (c) compulsory for those who wind up homeless in major cities.