1# - Find ogg 2# Find the native ogg includes and libraries 3# 4# OGG_INCLUDE_DIRS - where to find ogg.h, etc. 5# OGG_LIBRARIES - List of libraries when using ogg. 6# OGG_FOUND - True if ogg found. 7 8if (OGG_INCLUDE_DIR) 9 # Already in cache, be silent 10 set(OGG_FIND_QUIETLY TRUE) 11endif () 12 13find_package (PkgConfig QUIET) 14pkg_check_modules (PC_OGG QUIET ogg>=1.3.0) 15 16set (OGG_VERSION ${PC_OGG_VERSION}) 17 18find_path (OGG_INCLUDE_DIR ogg/ogg.h 19 HINTS 20 ${PC_OGG_INCLUDEDIR} 21 ${PC_OGG_INCLUDE_DIRS} 22 ${OGG_ROOT} 23 ) 24# MSVC built ogg may be named ogg_static. 25# The provided project files name the library with the lib prefix. 26find_library (OGG_LIBRARY 27 NAMES 28 ogg 29 ogg_static 30 libogg 31 libogg_static 32 HINTS 33 ${PC_OGG_LIBDIR} 34 ${PC_OGG_LIBRARY_DIRS} 35 ${OGG_ROOT} 36 ) 37# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND 38# to TRUE if all listed variables are TRUE. 39include (FindPackageHandleStandardArgs) 40find_package_handle_standard_args (Ogg 41 REQUIRED_VARS 42 OGG_LIBRARY 43 OGG_INCLUDE_DIR 44 VERSION_VAR 45 OGG_VERSION 46 ) 47 48if (OGG_FOUND) 49 set (OGG_LIBRARIES ${OGG_LIBRARY}) 50 set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR}) 51 52 if(NOT TARGET Ogg::ogg) 53 add_library(Ogg::ogg UNKNOWN IMPORTED) 54 set_target_properties(Ogg::ogg PROPERTIES 55 INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}" 56 IMPORTED_LOCATION "${OGG_LIBRARIES}" 57 ) 58 endif () 59endif () 60 61mark_as_advanced (OGG_INCLUDE_DIR OGG_LIBRARY) 62