# Prefer the BSP's pkg-config metadata, preserving its transitive link flags. # SDKs without a .pc file can use -DRockchipMPP_ROOT=/path/to/prefix. find_package(PkgConfig QUIET) if(PkgConfig_FOUND) pkg_check_modules(PC_RockchipMPP QUIET IMPORTED_TARGET rockchip_mpp) endif() find_path(RockchipMPP_INCLUDE_DIR NAMES rk_mpi.h HINTS ${PC_RockchipMPP_INCLUDE_DIRS} PATH_SUFFIXES rockchip mpp include/rockchip include/mpp include) include(FindPackageHandleStandardArgs) if(TARGET PkgConfig::PC_RockchipMPP) set(RockchipMPP_VERSION "${PC_RockchipMPP_VERSION}") find_package_handle_standard_args(RockchipMPP REQUIRED_VARS RockchipMPP_INCLUDE_DIR VERSION_VAR RockchipMPP_VERSION) if(RockchipMPP_FOUND AND NOT TARGET RockchipMPP::MPP) add_library(RockchipMPP::MPP INTERFACE IMPORTED) set_target_properties(RockchipMPP::MPP PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${RockchipMPP_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES PkgConfig::PC_RockchipMPP) endif() else() find_library(RockchipMPP_LIBRARY NAMES rockchip_mpp mpp) find_package_handle_standard_args(RockchipMPP REQUIRED_VARS RockchipMPP_INCLUDE_DIR RockchipMPP_LIBRARY REASON_FAILURE_MESSAGE "Install the target BSP's MPP development SDK, or set RockchipMPP_ROOT. Host-only builds use ROCKSTREAM_WITH_MPP=OFF.") if(RockchipMPP_FOUND AND NOT TARGET RockchipMPP::MPP) add_library(RockchipMPP::MPP UNKNOWN IMPORTED) set_target_properties(RockchipMPP::MPP PROPERTIES IMPORTED_LOCATION "${RockchipMPP_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${RockchipMPP_INCLUDE_DIR}") endif() mark_as_advanced(RockchipMPP_INCLUDE_DIR RockchipMPP_LIBRARY) endif()