(maint) Use CMake's REQUIRED flag on required dependencies

Previously, we were manually enforcing that some libraries were
required. This commit uses CMake's inbuilt facilities for doing this.
(maint) Move `lib` subdirectory add to top-level cmake

Previously, the `lib` dir was added from the exe CMake. This is not
idiomatic (add_subdirectory should be used only for true
subdirectories), but also gives a structural impression of "We are
building an executable that contains a library". Moving the `lib`
subdir add to the top-level gives the more accurate "We are building a
library and an executable (which happens to use our library)"
(maint) deduplicate CFLAGS
Merge pull request #59 from branan/refactor_cmake

Refactor cmake
(maint) Remove dependency on rapidjson from lib.

Recently we removed rapidjson as an external project dependency and
instead have unpacked it in the vendor directory.

As a result, the lib project should no longer have a dependency on
rapidjson, which is header-only.

This fixes a warning in CMake 3.0.
Merge pull request #60 from peterhuene/cmake

(maint) Remove dependency on rapidjson from lib.