Cmake

this should eliminate linker errors on some systems (for example ARCH)

NOTE: this series is a candidate for the stable branch