summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindSndio.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindSndio.cmake')
-rw-r--r--cmake/modules/FindSndio.cmake59
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
11include(CheckIncludeFiles)
12include(CheckIncludeFileCXX)
13include(CheckLibraryExists)
14 16
15# Already done by toplevel 17find_path(SNDIO_INCLUDE_DIR sndio.h)
16find_library(SNDIO_LIBRARY sndio) 18find_library(SNDIO_LIBRARY sndio)
17set(SNDIO_LIBRARY_DIR "")
18if(SNDIO_LIBRARY)
19 get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH)
20endif(SNDIO_LIBRARY)
21 19
22check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SNDIO) 20
23if(HAVE_SNDIO) 21include(FindPackageHandleStandardArgs)
24 message(STATUS "Found sndio: ${SNDIO_LIBRARY}") 22find_package_handle_standard_args(Sndio
25 set(SNDIO_DEFINITIONS -DHAVE_SNDIO=1) 23 REQUIRED_VARS SNDIO_LIBRARY SNDIO_INCLUDE_DIR)
24
25if(SNDIO_FOUND)
26 set(SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR})
26 set(SNDIO_LIBRARIES ${SNDIO_LIBRARY}) 27 set(SNDIO_LIBRARIES ${SNDIO_LIBRARY})
27else(HAVE_SNDIO) 28 set(SNDIO_DEFINITIONS -DHAVE_SNDIO=1)
28 message(STATUS "sndio not found") 29
29endif(HAVE_SNDIO) 30 if(NOT TARGET Sndio::Sndio)
30set(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()
38endif()
31 39
32find_path(SNDIO_INCLUDES sndio.h)
33 40
34mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY) 41mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY)