find_package(PkgConfig) pkg_check_modules(PC_LIBSWRESAMPLE QUIET libswresample) set(LIBSWRESAMPLE_STANDARD_DEFINITIONS ${PC_LIBSWRESAMPLE_CFLAGS_OTHER} CACHE STRING "Libswresample required CFLAGS") set(LIBSWRESAMPLE_STATIC_DEFINITIONS ${PC_LIBSWRESAMPLE_STATIC_CFLAGS_OTHER} CACHE STRING "Libswresample static required CFLAGS") find_path(LIBSWRESAMPLE_STANDARD_INCLUDE_DIR libswresample/swresample.h HINTS ${PC_LIBSWRESAMPLE_INCLUDEDIR} ${PC_LIBSWRESAMPLE_INCLUDE_DIRS} PATH_SUFFIXES libswresample) find_path(LIBSWRESAMPLE_STATIC_INCLUDE_DIR libswresample/swresample.h HINTS ${PC_LIBSWRESAMPLE_STATIC_INCLUDEDIR} ${PC_LIBSWRESAMPLE_STATIC_INCLUDE_DIRS} PATH_SUFFIXES libswresample) if(NOT LIBSWRESAMPLE_STANDARD_LIBRARIES) set(LIBSWRESAMPLE_STANDARD_LIBRARIES_ "") foreach(lib ${PC_LIBSWRESAMPLE_LIBRARIES}) find_library(_lib_file NAMES ${lib} HINTS ${PC_LIBSWRESAMPLE_LIBDIR} ${PC_LIBSWRESAMPLE_LIBRARY_DIRS}) if(_lib_file) LIST(APPEND LIBSWRESAMPLE_STANDARD_LIBRARIES_ ${_lib_file}) endif() unset(_lib_file CACHE) endforeach() set(LIBSWRESAMPLE_STANDARD_LIBRARIES ${LIBSWRESAMPLE_STANDARD_LIBRARIES_} CACHE STRING "Libswresample (dynamic) libraries") unset(LIBSWRESAMPLE_STANDARD_LIBRARIES_) endif() if(NOT LIBSWRESAMPLE_STATIC_LIBRARIES) set(LIBSWRESAMPLE_STATIC_LIBRARIES_ "") set(lib_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_MODULE_SUFFIX}) foreach(lib ${PC_LIBSWRESAMPLE_STATIC_LIBRARIES}) find_library(_lib_file NAMES ${lib} HINTS ${PC_LIBSWRESAMPLE_LIBDIR} ${PC_LIBSWRESAMPLE_LIBRARY_DIRS}) if(_lib_file) list(APPEND LIBSWRESAMPLE_STATIC_LIBRARIES_ ${_lib_file}) else() list(APPEND LIBSWRESAMPLE_STATIC_LIBRARIES_ ${lib}) endif() unset(_lib_file CACHE) endforeach() set(CMAKE_FIND_LIBRARY_SUFFIXES ${lib_suffixes}) set(LIBSWRESAMPLE_STATIC_LIBRARIES ${LIBSWRESAMPLE_STATIC_LIBRARIES_} CACHE STRING "Libswresample static libraries") unset(LIBSWRESAMPLE_STATIC_LIBRARIES_) endif() if(Libswresample_FIND_COMPONENTS AND Libswresample_FIND_COMPONENTS STREQUAL "static") set(LIBSWRESAMPLE_DEFINITION ${LIBSWRESAMPLE_STATIC_DEFINITIONS}) set(LIBSWRESAMPLE_INCLUDE_DIR ${LIBSWRESAMPLE_STATIC_INCLUDE_DIR}) set(LIBSWRESAMPLE_LIBRARY ${LIBSWRESAMPLE_STATIC_LIBRARIES}) else() set(LIBSWRESAMPLE_DEFINITION ${LIBSWRESAMPLE_STANDARD_DEFINITIONS}) set(LIBSWRESAMPLE_INCLUDE_DIR ${LIBSWRESAMPLE_STANDARD_INCLUDE_DIR}) set(LIBSWRESAMPLE_LIBRARY ${LIBSWRESAMPLE_STANDARD_LIBRARIES}) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Libswresample DEFAULT_MSG LIBSWRESAMPLE_INCLUDE_DIR LIBSWRESAMPLE_LIBRARY) if(LIBSWRESAMPLE_FOUND) set(LIBSWRESAMPLE_DEFINITIONS ${LIBSWRESAMPLE_DEFINITION}) set(LIBSWRESAMPLE_INCLUDE_DIRS ${LIBSWRESAMPLE_INCLUDE_DIR}) set(LIBSWRESAMPLE_LIBRARIES ${LIBSWRESAMPLE_LIBRARY}) endif() mark_as_advanced( LIBSWRESAMPLE_STANDARD_DEFINITIONS LIBSWRESAMPLE_STANDARD_INCLUDE_DIR LIBSWRESAMPLE_STANDARD_LIBRARIES LIBSWRESAMPLE_STATIC_DEFINITIONS LIBSWRESAMPLE_STATIC_INCLUDE_DIR LIBSWRESAMPLE_STATIC_LIBRARIES )