diff options
Diffstat (limited to 'cmake/modules/FindSndio.cmake')
| -rw-r--r-- | cmake/modules/FindSndio.cmake | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/cmake/modules/FindSndio.cmake b/cmake/modules/FindSndio.cmake index 4e66a4b..3dd53d9 100644 --- a/cmake/modules/FindSndio.cmake +++ b/cmake/modules/FindSndio.cmake | |||
| @@ -1,34 +1,41 @@ | |||
| 1 | # sndio check, based on FindAlsa.cmake | ||
| 2 | # | 1 | # |
| 3 | 2 | # FindSndio | |
| 4 | # Copyright (c) 2006, David Faure, <faure@kde.org> | 3 | # --------- |
| 5 | # Copyright (c) 2007, Matthias Kretz <kretz@kde.org> | 4 | # Finds the Sndio Library |
| 6 | # Copyright (c) 2009, Jacob Meuser <jakemsr@sdf.lonestar.org> | 5 | # |
| 6 | # This will will define the following variables: | ||
| 7 | # | ||
| 8 | # SNDIO_FOUND - system has sndio | ||
| 9 | # SNDIO_INCLUDE_DIRS - sndio include directory | ||
| 10 | # SNDIO_DEFINITIONS - sndio definitions | ||
| 11 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # Sndio::Sndio - the sndio library | ||
| 7 | # | 15 | # |
| 8 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
| 9 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
| 10 | |||
| 11 | include(CheckIncludeFiles) | ||
| 12 | include(CheckIncludeFileCXX) | ||
| 13 | include(CheckLibraryExists) | ||
| 14 | 16 | ||
| 15 | # Already done by toplevel | 17 | find_path(SNDIO_INCLUDE_DIR sndio.h) |
| 16 | find_library(SNDIO_LIBRARY sndio) | 18 | find_library(SNDIO_LIBRARY sndio) |
| 17 | set(SNDIO_LIBRARY_DIR "") | ||
| 18 | if(SNDIO_LIBRARY) | ||
| 19 | get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH) | ||
| 20 | endif(SNDIO_LIBRARY) | ||
| 21 | 19 | ||
| 22 | check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SNDIO) | 20 | |
| 23 | if(HAVE_SNDIO) | 21 | include(FindPackageHandleStandardArgs) |
| 24 | message(STATUS "Found sndio: ${SNDIO_LIBRARY}") | 22 | find_package_handle_standard_args(Sndio |
| 25 | set(SNDIO_DEFINITIONS -DHAVE_SNDIO=1) | 23 | REQUIRED_VARS SNDIO_LIBRARY SNDIO_INCLUDE_DIR) |
| 24 | |||
| 25 | if(SNDIO_FOUND) | ||
| 26 | set(SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR}) | ||
| 26 | set(SNDIO_LIBRARIES ${SNDIO_LIBRARY}) | 27 | set(SNDIO_LIBRARIES ${SNDIO_LIBRARY}) |
| 27 | else(HAVE_SNDIO) | 28 | set(SNDIO_DEFINITIONS -DHAVE_SNDIO=1) |
| 28 | message(STATUS "sndio not found") | 29 | |
| 29 | endif(HAVE_SNDIO) | 30 | if(NOT TARGET Sndio::Sndio) |
| 30 | set(SNDIO_FOUND ${HAVE_SNDIO}) | 31 | add_library(Sndio::Sndio UNKNOWN IMPORTED) |
| 32 | set_target_properties(Sndio::Sndio PROPERTIES | ||
| 33 | IMPORTED_LOCATION "${SNDIO_LIBRARY}" | ||
| 34 | INTERFACE_INCLUDE_DIRECTORIES "${SNDIO_INCLUDE_DIR}") | ||
| 35 | set_target_properties(Sndio::Sndio PROPERTIES | ||
| 36 | INTERFACE_COMPILE_DEFINITIONS -DHAVE_SNDIO=1) | ||
| 37 | endif() | ||
| 38 | endif() | ||
| 31 | 39 | ||
| 32 | find_path(SNDIO_INCLUDES sndio.h) | ||
| 33 | 40 | ||
| 34 | mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY) | 41 | mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY) |
