Use CMake compiler version flag to set GCC_COMPILER_VERSION variable

This should work across the board rather than having to parse the output
of 'gcc --version', which can be different on different platforms.
Refs #10353
Merge remote-tracking branch 'origin/bugfix/10353_cmake_gcc_version'