From 4c3251ec645c8b71820dab7e51e612e5919d4e75 Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 23 Jul 2017 16:59:43 +0200 Subject: sync with upstream --- cmake/modules/FindSndio.cmake | 59 ++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 26 deletions(-) (limited to 'cmake/modules/FindSndio.cmake') 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 @@ -# sndio check, based on FindAlsa.cmake # - -# Copyright (c) 2006, David Faure, -# Copyright (c) 2007, Matthias Kretz -# Copyright (c) 2009, Jacob Meuser +# FindSndio +# --------- +# Finds the Sndio Library +# +# This will will define the following variables: +# +# SNDIO_FOUND - system has sndio +# SNDIO_INCLUDE_DIRS - sndio include directory +# SNDIO_DEFINITIONS - sndio definitions +# +# and the following imported targets:: +# +# Sndio::Sndio - the sndio library # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -include(CheckIncludeFiles) -include(CheckIncludeFileCXX) -include(CheckLibraryExists) -# Already done by toplevel +find_path(SNDIO_INCLUDE_DIR sndio.h) find_library(SNDIO_LIBRARY sndio) -set(SNDIO_LIBRARY_DIR "") -if(SNDIO_LIBRARY) - get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH) -endif(SNDIO_LIBRARY) -check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SNDIO) -if(HAVE_SNDIO) - message(STATUS "Found sndio: ${SNDIO_LIBRARY}") - set(SNDIO_DEFINITIONS -DHAVE_SNDIO=1) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sndio + REQUIRED_VARS SNDIO_LIBRARY SNDIO_INCLUDE_DIR) + +if(SNDIO_FOUND) + set(SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR}) set(SNDIO_LIBRARIES ${SNDIO_LIBRARY}) -else(HAVE_SNDIO) - message(STATUS "sndio not found") -endif(HAVE_SNDIO) -set(SNDIO_FOUND ${HAVE_SNDIO}) + set(SNDIO_DEFINITIONS -DHAVE_SNDIO=1) + + if(NOT TARGET Sndio::Sndio) + add_library(Sndio::Sndio UNKNOWN IMPORTED) + set_target_properties(Sndio::Sndio PROPERTIES + IMPORTED_LOCATION "${SNDIO_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${SNDIO_INCLUDE_DIR}") + set_target_properties(Sndio::Sndio PROPERTIES + INTERFACE_COMPILE_DEFINITIONS -DHAVE_SNDIO=1) + endif() +endif() -find_path(SNDIO_INCLUDES sndio.h) -mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY) +mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY) -- cgit v1.2.3