cmake and ci improvements
Prerequisite for updates to basalt. If tests pass, it should be ready for merge.
Summary of changes:
- ci: add build jobs for Debug/RelWithDebInfo on Bionic, as well as release builds on Xenial and El Capitan. Use templates to simplify .gitlab-ci.yml
- cmake: raise minimum version to 3.10
- cmake: add workarounds to support macOS < 10.14
- cmake: set ccache only if not yet set and print info
- cmake: add NDEBUG define (to disable asserts) for release build and EIGEN_INITIALIZE_MATRICES_BY_NAN for others. Add externally supplied CMAKE_CXX_FLAGS at the end to allow overriding the defaults.
- tests: add enable_testing() in main CMakeLists.txt, such that we can call 'ctest' from build folder.
- tests: simplify gtest / gtest_main linking
- tests: enabled benchmarks only on Linux with GCC (doesn't compile with clang)
- tests: use the newer gtest_discover_tests instead of add_test, which adds a separate cmake test for every gtest, even with multiple defined in a single executable. Its not only more reliable and less verbose in the CMakeLists.txt, but also allows to run 'ctest' without -V and still see status for every individual test.