1find_package(PkgConfig) 2pkg_check_modules(_OGG QUIET ogg) 3 4find_path(OGG_INCLUDE_DIR 5 NAMES "ogg/ogg.h" 6 PATHS ${_OGG_INCLUDE_DIRS}) 7 8find_library(OGG_LIBRARY 9 NAMES ogg libogg 10 HINTS ${_OGG_LIBRARY_DIRS}) 11 12mark_as_advanced( 13 OGG_INCLUDE_DIR 14 OGG_LIBRARY) 15 16include(FindPackageHandleStandardArgs) 17find_package_handle_standard_args(Ogg 18 REQUIRED_VARS OGG_INCLUDE_DIR OGG_LIBRARY 19 VERSION_VAR _OGG_VERSION) 20 21if(OGG_FOUND AND NOT TARGET Ogg::ogg) 22 add_library(Ogg::ogg UNKNOWN IMPORTED) 23 set_target_properties(Ogg::ogg PROPERTIES 24 INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIR}" 25 IMPORTED_LOCATION "${OGG_LIBRARY}") 26endif() 27