Fix build system issues.
Added tests to CMake build system.
Added examples to CMake build system.