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 (cherry picked from commit e2944b0aa11fa43a6ae820c9d03e44098ccad46c)
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bccc36..c43d139 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -359,9 +359,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() @@ -855,9 +857,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()