Quoted all CMake paths with substitution.

Fixes #258.
Use CMake threading variable for Wayland.