Restore the initial state at the end of line.

This matters for stateful encodings like iso-2022-jp.
Tweak the cmake file a little bit.