Merge pull request #382 from wasphin/feature/use-pkgconfig-to-find-libav

优先使用 pkg-config 来查找 AV* 库
This commit is contained in:
夏楚 2020-07-02 18:20:01 +08:00 committed by GitHub
commit 236219c589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,20 +8,38 @@ if (SDL2_FOUND)
message(STATUS "found library:${SDL2_LIBRARY}")
endif (SDL2_FOUND)
find_package(PkgConfig QUIET)
#ffmpeg/libutil
find_package(AVUTIL QUIET)
if(AVUTIL_FOUND)
if(PKG_CONFIG_FOUND)
pkg_check_modules(AVUTIL QUIET IMPORTED_TARGET libavutil)
if(AVUTIL_FOUND)
list(APPEND LINK_LIB_LIST PkgConfig::AVUTIL)
message(STATUS "found library:${AVUTIL_LIBRARY}")
endif()
else()
find_package(AVUTIL QUIET)
if(AVUTIL_FOUND)
include_directories(${AVUTIL_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${AVUTIL_LIBRARIES})
message(STATUS "found library:${AVUTIL_LIBRARIES}")
endif()
endif()
#ffmpeg/libavcodec
find_package(AVCODEC QUIET)
if(AVCODEC_FOUND)
if(PKG_CONFIG_FOUND)
pkg_check_modules(AVCODEC QUIET IMPORTED_TARGET libavcodec)
if(AVCODEC_FOUND)
list(APPEND LINK_LIB_LIST PkgConfig::AVCODEC)
message(STATUS "found library:${AVCODEC_LIBRARY}")
endif()
else()
find_package(AVCODEC QUIET)
if(AVCODEC_FOUND)
include_directories(${AVCODEC_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${AVCODEC_LIBRARIES})
message(STATUS "found library:${AVCODEC_LIBRARIES}")
endif()
endif()
aux_source_directory(. TEST_SRC_LIST)