Add shared library support to the CMake build.

This is enabled via:
$ cmake path/to/aom -DBUILD_SHARED_LIBS=1

Currently supports only Linux and MacOS targets. Symbol visibility
is handled by exports.cmake and its helpers exports_sources.cmake
and generate_exports.cmake.

Some sweeping changes were required to properly support shared libs
and control symbol visibility:

- Object libraries are always linked privately into static
  libraries.
- Static libraries are always linked privately into eachother
  in the many cases where the CMake build merges multiple library
  targets.
- aom_dsp.cmake now links all its targets into the aom_dsp static
  library target, and privately links aom_dsp into the aom target.
- av1.cmake now links all its targets into the aom_av1 static library
  target, and privately links in aom_dsp and aom_scale as well. It
  then privately links aom_av1 into the aom target.
- The aom_mem, aom_ports, aom_scale, and aom_util targets are now
  static libs that are privately linked into the aom target.
- In CMakeLists.txt libyuv and libwebm are now privately linked into
  app targets.
- The ASM and intrinsic library functions in aom_optimization.cmake
  now both require a dependent target argument. This facilitates the
  changes noted above regarding new privately linked static library
  targets for ASM and intrinsics sources.

BUG=aomedia:76,aomedia:556

Change-Id: I4892059880c5de0f479da2e9c21d8ba2fa7390c3
diff --git a/aom_scale/aom_scale.cmake b/aom_scale/aom_scale.cmake
index e1e3f6c..58d9a5f 100644
--- a/aom_scale/aom_scale.cmake
+++ b/aom_scale/aom_scale.cmake
@@ -25,12 +25,12 @@
 # Creates the aom_scale build target and makes libaom depend on it. The libaom
 # target must exist before this function is called.
 function (setup_aom_scale_targets)
-  add_library(aom_scale OBJECT ${AOM_SCALE_SOURCES})
-  target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_scale>)
+  add_library(aom_scale STATIC ${AOM_SCALE_SOURCES})
+  target_link_libraries(aom PRIVATE aom_scale)
 
   if (HAVE_DSPR2)
     add_intrinsics_object_library("" "dspr2" "aom_scale"
-                                  "AOM_SCALE_INTRIN_DSPR2")
+                                  "AOM_SCALE_INTRIN_DSPR2" "aom_scale")
   endif ()
 
   set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_scale PARENT_SCOPE)