Cmake library macro 2

@sherm1 recently reviewed my PR #201 (thank you!), but merged it before I corrected the things he wanted me to change. I've gone ahead and made those changes, and I have also done some general clean up. 

I'll let this PR sit here for a a few days. If no one merges it, then I'll merge it, as I'm mostly addressing previous comments.