1 # Sndio check, based on libkmid/configure.in.in.
3 # It offers the following macros:
4 # SNDIO_CONFIGURE_FILE(config_header) - generate a config.h, typical usage:
5 # SNDIO_CONFIGURE_FILE(${CMAKE_BINARY_DIR}/config-sndio.h)
7 # Copyright (c) 2020, Kinichiro Inoguchi
9 # Redistribution and use is allowed according to the terms of the BSD license.
10 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12 include(CheckIncludeFiles)
13 include(CheckIncludeFileCXX)
14 include(CheckLibraryExists)
16 # Already done by toplevel
17 find_library(SNDIO_LIBRARY sndio)
18 set(SNDIO_LIBRARY_DIR "")
20 get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH)
23 check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_LIBSNDIO)
25 message(STATUS "Found SNDIO: ${SNDIO_LIBRARY}")
27 message(STATUS "SNDIO not found")
29 set(SNDIO_FOUND ${HAVE_LIBSNDIO})
31 find_path(SNDIO_INCLUDES sndio.h)
33 get_filename_component(_FIND_SNDIO_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
34 macro(SNDIO_CONFIGURE_FILE _destFile)
35 configure_file(${_FIND_SNDIO_MODULE_DIR}/config-sndio.h.cmake ${_destFile})
36 endmacro(SNDIO_CONFIGURE_FILE _destFile)
38 mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY)