build: default to using -O2 for release builds

The -O3 optimization level can often lead to dangerous (and sometimes
incorrect) optimizations being performed.  So let's use a level that's
more stable.
build: don't download and extract tarball if source is already present

When building under Homebrew, we want to let Homebrew manage
downloading and extracting the tarballs. See PR #1411.

Also make sure to skip only if directory is not empty. Fix #1433.
Merge pull request #1434 from xu-cheng/fix-1433

DownloadAndExtractFile.cmake: only skip if directory is not empty.
Merge pull request #1426 from jszakmeister/change-release-opt-default

build: default to using -O2 for release builds