Modified to use it as a library.

Some nasty configurations where modified and the test executables are no longer generated.