1b815c7f3Sopenharmony_ci# - Find mpg123 2b815c7f3Sopenharmony_ci# Find the native mpg123 includes and libraries 3b815c7f3Sopenharmony_ci# 4b815c7f3Sopenharmony_ci# MPG123_INCLUDE_DIRS - where to find mpg123.h, etc. 5b815c7f3Sopenharmony_ci# MPG123_LIBRARIES - List of libraries when using mpg123. 6b815c7f3Sopenharmony_ci# MPG123_FOUND - True if Mpg123 found. 7b815c7f3Sopenharmony_ci 8b815c7f3Sopenharmony_ciif (MPG123_INCLUDE_DIR) 9b815c7f3Sopenharmony_ci # Already in cache, be silent 10b815c7f3Sopenharmony_ci set(MPG123_FIND_QUIETLY TRUE) 11b815c7f3Sopenharmony_ciendif () 12b815c7f3Sopenharmony_ci 13b815c7f3Sopenharmony_cifind_package (PkgConfig QUIET) 14b815c7f3Sopenharmony_cipkg_check_modules(PC_MPG123 QUIET libmpg123>=1.25.10) 15b815c7f3Sopenharmony_ci 16b815c7f3Sopenharmony_ciset (MPG123_VERSION ${PC_MPG123_VERSION}) 17b815c7f3Sopenharmony_ci 18b815c7f3Sopenharmony_cifind_path (MPG123_INCLUDE_DIR mpg123.h 19b815c7f3Sopenharmony_ci HINTS 20b815c7f3Sopenharmony_ci ${PC_MPG123_INCLUDEDIR} 21b815c7f3Sopenharmony_ci ${PC_MPG123_INCLUDE_DIRS} 22b815c7f3Sopenharmony_ci ${MPG123_ROOT} 23b815c7f3Sopenharmony_ci ) 24b815c7f3Sopenharmony_ci 25b815c7f3Sopenharmony_ci# MSVC built mpg123 may be named mpg123_static. 26b815c7f3Sopenharmony_ci# The provided project files name the library with the lib prefix. 27b815c7f3Sopenharmony_ci 28b815c7f3Sopenharmony_cifind_library (MPG123_LIBRARY 29b815c7f3Sopenharmony_ci NAMES 30b815c7f3Sopenharmony_ci mpg123 31b815c7f3Sopenharmony_ci mpg123_static 32b815c7f3Sopenharmony_ci libmpg123 33b815c7f3Sopenharmony_ci libmpg123_static 34b815c7f3Sopenharmony_ci HINTS 35b815c7f3Sopenharmony_ci ${PC_MPG123_LIBDIR} 36b815c7f3Sopenharmony_ci ${PC_MPG123_LIBRARY_DIRS} 37b815c7f3Sopenharmony_ci ${MPG123_ROOT} 38b815c7f3Sopenharmony_ci ) 39b815c7f3Sopenharmony_ci 40b815c7f3Sopenharmony_ci# Handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND 41b815c7f3Sopenharmony_ci# to TRUE if all listed variables are TRUE. 42b815c7f3Sopenharmony_ciinclude(FindPackageHandleStandardArgs) 43b815c7f3Sopenharmony_cifind_package_handle_standard_args (Mpg123 44b815c7f3Sopenharmony_ci REQUIRED_VARS 45b815c7f3Sopenharmony_ci MPG123_LIBRARY 46b815c7f3Sopenharmony_ci MPG123_INCLUDE_DIR 47b815c7f3Sopenharmony_ci VERSION_VAR 48b815c7f3Sopenharmony_ci MPG123_VERSION 49b815c7f3Sopenharmony_ci ) 50b815c7f3Sopenharmony_ci 51b815c7f3Sopenharmony_ciif (MPG123_FOUND) 52b815c7f3Sopenharmony_ci set (MPG123_LIBRARIES ${MPG123_LIBRARY}) 53b815c7f3Sopenharmony_ci set (MPG123_INCLUDE_DIRS ${MPG123_INCLUDE_DIR}) 54b815c7f3Sopenharmony_ci 55b815c7f3Sopenharmony_ci if (NOT TARGET MPG123::libmpg123) 56b815c7f3Sopenharmony_ci add_library (MPG123::libmpg123 UNKNOWN IMPORTED) 57b815c7f3Sopenharmony_ci set_target_properties (MPG123::libmpg123 PROPERTIES 58b815c7f3Sopenharmony_ci INTERFACE_INCLUDE_DIRECTORIES "${MPG123_INCLUDE_DIRS}" 59b815c7f3Sopenharmony_ci IMPORTED_LOCATION "${MPG123_LIBRARIES}" 60b815c7f3Sopenharmony_ci ) 61b815c7f3Sopenharmony_ci endif () 62b815c7f3Sopenharmony_ciendif () 63b815c7f3Sopenharmony_ci 64b815c7f3Sopenharmony_cimark_as_advanced(MPG123_INCLUDE_DIR MPG123_LIBRARY) 65