Fix some CMake target issues.
Merge branch 'garth/fix-cmake-3-issues' into next