split unittest class into header and cpp file
cmake: fix a few warnings and add an option to build unittests