Untangle the messy CMakefile, a little bit

Don't use one CMakefile to build two directories.
Use one per directory, make things a little easier to read...
fix testcase to go with last round of changes