zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

FindSndio.cmake (1320B)


      1 # Sndio check, based on libkmid/configure.in.in.
      2 # It defines ...
      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)
      6 
      7 # Copyright (c) 2020, Kinichiro Inoguchi
      8 #
      9 # Redistribution and use is allowed according to the terms of the BSD license.
     10 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
     11 
     12 include(CheckIncludeFiles)
     13 include(CheckIncludeFileCXX)
     14 include(CheckLibraryExists)
     15 
     16 # Already done by toplevel
     17 find_library(SNDIO_LIBRARY sndio)
     18 set(SNDIO_LIBRARY_DIR "")
     19 if(SNDIO_LIBRARY)
     20    get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH)
     21 endif(SNDIO_LIBRARY)
     22 
     23 check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_LIBSNDIO)
     24 if(HAVE_LIBSNDIO)
     25     message(STATUS "Found SNDIO: ${SNDIO_LIBRARY}")
     26 else(HAVE_LIBSNDIO)
     27     message(STATUS "SNDIO not found")
     28 endif(HAVE_LIBSNDIO)
     29 set(SNDIO_FOUND ${HAVE_LIBSNDIO})
     30 
     31 find_path(SNDIO_INCLUDES sndio.h)
     32 
     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)
     37 
     38 mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY)