2020-01-02 16:52:30 +00:00
|
|
|
# - Try to find SndFile
|
|
|
|
# Once done this will define
|
|
|
|
#
|
|
|
|
# SNDFILE_FOUND - system has SndFile
|
|
|
|
# SNDFILE_INCLUDE_DIRS - the SndFile include directory
|
|
|
|
# SNDFILE_LIBRARIES - Link these to use SndFile
|
|
|
|
#
|
|
|
|
# Copyright © 2006 Wengo
|
|
|
|
# Copyright © 2009 Guillaume Martres
|
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the New
|
|
|
|
# BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
#
|
|
|
|
|
2021-01-08 21:49:44 +00:00
|
|
|
if(NOT SNDFILE_INCLUDE_DIR)
|
|
|
|
find_path(SNDFILE_INCLUDE_DIR NAMES sndfile.h)
|
|
|
|
endif()
|
2020-01-02 16:52:30 +00:00
|
|
|
|
2021-01-08 21:49:44 +00:00
|
|
|
if(NOT SNDFILE_LIBRARY)
|
|
|
|
find_library(SNDFILE_LIBRARY NAMES sndfile sndfile-1)
|
|
|
|
endif()
|
2020-01-02 16:52:30 +00:00
|
|
|
|
2021-01-08 21:49:44 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2020-01-02 16:52:30 +00:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
|
|
|
|
# all listed variables are TRUE
|
2021-01-08 21:49:44 +00:00
|
|
|
find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
|
|
|
|
|
|
|
|
if(SNDFILE_FOUND)
|
|
|
|
add_library(sndfile UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(sndfile
|
|
|
|
PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${SNDFILE_LIBRARY}"
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${SNDFILE_INCLUDE_DIR}"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(SndFile::sndfile ALIAS sndfile)
|
2020-01-02 16:52:30 +00:00
|
|
|
|
2021-01-08 21:49:44 +00:00
|
|
|
# Legacy variables
|
|
|
|
set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}")
|
|
|
|
set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}")
|
|
|
|
endif()
|