2020-10-31 22:14:28 +00:00
|
|
|
# Found on http://hg.kvats.net
|
|
|
|
#
|
|
|
|
# - Try to find libsndfile
|
|
|
|
#
|
|
|
|
# Once done this will define
|
|
|
|
#
|
2020-12-06 12:54:06 +00:00
|
|
|
# SNDFILE_FOUND - system has libsndfile
|
2020-10-31 22:14:28 +00:00
|
|
|
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
|
2020-12-06 12:54:06 +00:00
|
|
|
# SNDFILE_LIBRARIES - Link these to use libsndfile
|
|
|
|
# SNDFILE_CFLAGS - Compile options to use libsndfile
|
2020-12-06 18:12:35 +00:00
|
|
|
# SndFile::SndFile - Imported library of libsndfile
|
2020-10-31 22:14:28 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2006 Wengo
|
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the New
|
|
|
|
# BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
#
|
|
|
|
|
2020-12-06 12:54:06 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
if(PKG_CONFIG_FOUND)
|
|
|
|
pkg_search_module(PKG_SNDFILE "sndfile")
|
|
|
|
endif()
|
2020-10-31 22:14:28 +00:00
|
|
|
|
2020-12-06 12:54:06 +00:00
|
|
|
find_path(SNDFILE_INCLUDE_DIR
|
2020-10-31 22:14:28 +00:00
|
|
|
NAMES
|
2020-12-06 12:54:06 +00:00
|
|
|
sndfile.h
|
|
|
|
HINTS
|
|
|
|
${PKG_SNDFILE_INCLUDE_DIRS}
|
2020-10-31 22:14:28 +00:00
|
|
|
PATHS
|
2020-12-06 12:54:06 +00:00
|
|
|
/usr/include
|
|
|
|
/usr/local/include
|
|
|
|
/opt/local/include
|
|
|
|
/sw/include
|
|
|
|
)
|
|
|
|
|
|
|
|
find_library(SNDFILE_LIBRARY
|
2020-10-31 22:14:28 +00:00
|
|
|
NAMES
|
2020-12-06 12:54:06 +00:00
|
|
|
sndfile
|
|
|
|
HINTS
|
|
|
|
${PKG_SNDFILE_LIBRARIES}
|
2020-10-31 22:14:28 +00:00
|
|
|
PATHS
|
2020-12-06 12:54:06 +00:00
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/opt/local/lib
|
|
|
|
/sw/lib
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile")
|
2020-10-31 22:14:28 +00:00
|
|
|
|
2020-12-06 18:12:35 +00:00
|
|
|
set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}")
|
|
|
|
set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}")
|
2020-10-31 22:14:28 +00:00
|
|
|
|
2021-01-03 15:30:45 +00:00
|
|
|
if(SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
|
|
|
|
set(SNDFILE_FOUND TRUE)
|
|
|
|
endif()
|
2020-10-31 22:14:28 +00:00
|
|
|
|
2020-12-06 12:54:06 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
|
2020-10-31 22:14:28 +00:00
|
|
|
|
2020-12-06 12:54:06 +00:00
|
|
|
if(NOT TARGET SndFile::SndFile)
|
|
|
|
add_library(__SndFile INTERFACE)
|
|
|
|
target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS})
|
|
|
|
target_include_directories(__SndFile INTERFACE ${SNDFILE_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(__SndFile INTERFACE ${SNDFILE_LIBRARIES})
|
|
|
|
add_library(SndFile::SndFile ALIAS __SndFile)
|
|
|
|
endif()
|