(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