2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2011 Blender Authors
|
2023-06-14 22:49:59 +10:00
|
|
|
#
|
2022-02-11 14:23:56 +11:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
2011-06-18 12:12:19 +00:00
|
|
|
# - Find SndFile library
|
|
|
|
|
# Find the native SndFile includes and library
|
|
|
|
|
# This module defines
|
2017-08-18 08:24:12 +02:00
|
|
|
# LIBSNDFILE_INCLUDE_DIRS, where to find sndfile.h, Set when
|
|
|
|
|
# LIBSNDFILE_INCLUDE_DIR is found.
|
|
|
|
|
# LIBSNDFILE_LIBRARIES, libraries to link against to use SndFile.
|
|
|
|
|
# LIBSNDFILE_ROOT_DIR, The base directory to search for SndFile.
|
2011-06-18 12:12:19 +00:00
|
|
|
# This can also be an environment variable.
|
2019-07-19 09:14:15 +10:00
|
|
|
# SNDFILE_FOUND, If false, do not try to use SndFile.
|
2011-06-18 12:12:19 +00:00
|
|
|
#
|
|
|
|
|
# also defined, but not for general use are
|
2017-08-18 08:24:12 +02:00
|
|
|
# LIBSNDFILE_LIBRARY, where to find the SndFile library.
|
2011-06-18 12:12:19 +00:00
|
|
|
|
2023-07-29 13:47:55 +10:00
|
|
|
# If `LIBSNDFILE_ROOT_DIR` was defined in the environment, use it.
|
2023-08-17 13:15:56 +10:00
|
|
|
if(DEFINED LIBSNDFILE_ROOT_DIR)
|
2023-07-29 13:47:55 +10:00
|
|
|
# Pass.
|
2023-08-17 13:15:56 +10:00
|
|
|
elseif(DEFINED ENV{LIBSNDFILE_ROOT_DIR})
|
|
|
|
|
set(LIBSNDFILE_ROOT_DIR $ENV{LIBSNDFILE_ROOT_DIR})
|
|
|
|
|
else()
|
|
|
|
|
set(LIBSNDFILE_ROOT_DIR "")
|
|
|
|
|
endif()
|
2011-06-18 12:12:19 +00:00
|
|
|
|
2023-08-17 13:15:56 +10:00
|
|
|
set(_sndfile_SEARCH_DIRS
|
2017-08-18 08:24:12 +02:00
|
|
|
${LIBSNDFILE_ROOT_DIR}
|
2011-06-18 12:12:19 +00:00
|
|
|
)
|
|
|
|
|
|
2023-08-17 13:15:56 +10:00
|
|
|
find_path(LIBSNDFILE_INCLUDE_DIR sndfile.h
|
2011-06-18 12:12:19 +00:00
|
|
|
HINTS
|
|
|
|
|
${_sndfile_SEARCH_DIRS}
|
|
|
|
|
PATH_SUFFIXES
|
|
|
|
|
include
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-17 13:15:56 +10:00
|
|
|
find_library(LIBSNDFILE_LIBRARY
|
2011-06-20 02:54:56 +00:00
|
|
|
NAMES
|
|
|
|
|
sndfile
|
|
|
|
|
HINTS
|
|
|
|
|
${_sndfile_SEARCH_DIRS}
|
|
|
|
|
PATH_SUFFIXES
|
|
|
|
|
lib64 lib
|
2025-01-03 13:23:38 +11:00
|
|
|
)
|
2011-06-18 12:12:19 +00:00
|
|
|
|
2019-07-19 09:14:15 +10:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
|
2011-06-18 12:12:19 +00:00
|
|
|
# all listed variables are TRUE
|
2023-08-17 13:15:56 +10:00
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
|
find_package_handle_standard_args(SndFile DEFAULT_MSG
|
2017-08-18 08:24:12 +02:00
|
|
|
LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
|
2011-06-18 12:12:19 +00:00
|
|
|
|
2023-08-17 13:15:56 +10:00
|
|
|
if(SNDFILE_FOUND)
|
|
|
|
|
set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
|
|
|
|
|
set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
|
|
|
|
|
endif()
|
2011-06-18 12:12:19 +00:00
|
|
|
|
2023-08-17 13:15:56 +10:00
|
|
|
mark_as_advanced(
|
2017-08-18 08:24:12 +02:00
|
|
|
LIBSNDFILE_INCLUDE_DIR
|
|
|
|
|
LIBSNDFILE_LIBRARY
|
2011-06-19 07:46:24 +00:00
|
|
|
)
|
2024-03-08 10:53:03 +11:00
|
|
|
|
|
|
|
|
unset(_sndfile_SEARCH_DIRS)
|