fix compilation errors and cmake issues to be able to ctest