cmake: fix vmaf link w/-DBUILD_SHARED_LIBS=1 Add target_link_libraries(aom_static). This target was added in: 0f23ada000 cmake: Fix aom linkage race condition on MSVC This target is used to link the examples and tests and was missing the vmaf library, resulting in undefined symbols. Also remove -static with -DBUILD_SHARED_LIBS=0 as this may fail if only the shared object files are available, e.g., in the vmaf package on Arch Linux. Bug: aomedia:3464 Fixed: aomedia:3464 Change-Id: I314f961bfaa3819c4474d1a659e1c1575b58206c (cherry picked from commit 59f32b622ee313eb0cd501a6cffdee54223aff10)
diff --git a/CMakeLists.txt b/CMakeLists.txt index 371ecd6..2210905 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -640,12 +640,10 @@ if(PKG_CONFIG_FOUND) pkg_check_modules(VMAF REQUIRED libvmaf) if(BUILD_SHARED_LIBS) - target_link_libraries(aom PRIVATE ${VMAF_LDFLAGS} ${VMAF_LIBRARIES}) - else() - target_link_libraries(aom - PRIVATE ${VMAF_LDFLAGS} ${VMAF_LIBRARIES} -static) + target_link_libraries(aom_static + PRIVATE ${VMAF_LDFLAGS} ${VMAF_LIBRARIES}) endif() - target_include_directories(aom PRIVATE ${VMAF_INCLUDE_DIRS}) + target_link_libraries(aom PRIVATE ${VMAF_LDFLAGS} ${VMAF_LIBRARIES}) target_include_directories(aom_dsp_encoder PRIVATE ${VMAF_INCLUDE_DIRS}) if(VMAF_CFLAGS) foreach(flag "${VMAF_CFLAGS}")