third_party_libsnd/cmake/FindSndio.cmake

62 lines
1.4 KiB
CMake
Raw Permalink Normal View History

# - Find SoundIO (sndio) includes and libraries
#
2018-08-19 03:56:17 +00:00
# SNDIO_FOUND - True if SNDIO_INCLUDE_DIR & SNDIO_LIBRARY are
# found
# SNDIO_LIBRARIES - Set when SNDIO_LIBRARY is found
# SNDIO_INCLUDE_DIRS - Set when SNDIO_INCLUDE_DIR is found
#
# SNDIO_INCLUDE_DIR - where to find sndio.h, etc.
# SNDIO_LIBRARY - the sndio library
#
2018-08-19 03:56:17 +00:00
if (SNDIO_INCLUDE_DIR)
# Already in cache, be silent
set (SNDIO_FIND_QUIETLY TRUE)
endif ()
2018-08-19 03:56:17 +00:00
find_package (PkgConfig QUIET)
pkg_check_modules (PC_SNDIO QUIET sndio)
2018-08-19 03:56:17 +00:00
set (SNDIO_VERSION ${PC_SNDIO_VERSION})
2018-08-19 03:56:17 +00:00
find_path (SNDIO_INCLUDE_DIR
NAMES
sndio.h
HINTS
${PC_SNDIO_INCLUDEDIR}
${PC_SNDIO_INCLUDE_DIRS}
${SNDIO_ROOT}
)
find_library (SNDIO_LIBRARY
NAMES
sndio
HINTS
${PC_SNDIO_LIBDIR}
${PC_SNDIO_LIBRARY_DIRS}
${SNDIO_ROOT}
)
2018-08-19 03:56:17 +00:00
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (Sndio
REQUIRED_VARS
SNDIO_LIBRARY
SNDIO_INCLUDE_DIR
VERSION_VAR
SNDIO_VERSION
)
if (SNDIO_FOUND)
set (SNDIO_LIBRARIES ${SNDIO_LIBRARY})
set (SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR})
if (NOT TARGET Sndio::Sndio)
add_library (Sndio::Sndio UNKNOWN IMPORTED)
set_target_properties (Sndio::Sndio PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SNDIO_INCLUDE_DIRS}"
IMPORTED_LOCATION "${SNDIO_LIBRARIES}"
)
endif()
endif()
2018-08-19 03:56:17 +00:00
mark_as_advanced (SNDIO_INCLUDE_DIR SNDIO_LIBRARY)