Well before the movie with Will Smith in it, "The Omega Man" was made (starring Charlton Heston, in 1971), based on the same written piece, but even before THAT movie, the novel was adapted for film as "The Last Man On Earth," about a decade after the book appeared in print.
The movie, The Last Man On Earth (1964): Enjoy!
Matheson helped write some of the screenplay for the movie but apparently was not truly pleased with how the piece was working out, so he requested to be listed under a pseudonym when the film was finished and released. Mind you, this tidbit comes to be from reading up on this film on Wikipedia and this "fact" isn't supported by any citation, so I'm putting it forward just as something to consider. (*Note: if anyone can find an interview where the write has actually stated that he didn't like the screenplay writings, please let me know and I'll post an update). Look for Matheson credited as "Logan Swanson" in the credits.