aom shared lib should only have PRIVATE link libs

The aom shared library should only link with the m and Threads::Threads
libraries in PRIVATE scope so that the library dependencies do not
become part of the link interface.

Bug: 525452409
Change-Id: I2d20dd1d75f7184556d3bb1768a55f0044e9bf4d
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4a26d0..b335d07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -360,9 +360,11 @@
 endif()
 
 if(NOT WIN32 AND NOT APPLE)
-  target_link_libraries(aom ${AOM_LIB_LINK_TYPE} m)
   if(BUILD_SHARED_LIBS)
+    target_link_libraries(aom PRIVATE m)
     target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} m)
+  else()
+    target_link_libraries(aom ${AOM_LIB_LINK_TYPE} m)
   endif()
 endif()
 
@@ -856,9 +858,11 @@
 
 if(HAVE_PTHREAD_H AND CONFIG_MULTITHREAD)
   find_package(Threads)
-  target_link_libraries(aom ${AOM_LIB_LINK_TYPE} Threads::Threads)
   if(BUILD_SHARED_LIBS)
+    target_link_libraries(aom PRIVATE Threads::Threads)
     target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} Threads::Threads)
+  else()
+    target_link_libraries(aom ${AOM_LIB_LINK_TYPE} Threads::Threads)
   endif()
 endif()