set(SndFile_VERSION @PROJECT_VERSION@)
set(SndFile_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
set(SndFile_VERSION_MINOR @PROJECT_VERSION_MINOR@)
set(SndFile_VERSION_PATCH @PROJECT_VERSION_PATCH@)

set (SndFile_WITH_EXTERNAL_LIBS @SndFile_WITH_EXTERNAL_LIBS@)

@PACKAGE_INIT@

include (CMakeFindDependencyMacro)

find_dependency (Ogg 1.3)
find_dependency (VorbisEnc)
find_dependency (FLAC)
find_dependency (Opus)

include (${CMAKE_CURRENT_LIST_DIR}/SndFileTargets.cmake)

set_and_check (SndFile_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
set (SNDFILE_INCLUDE_DIR ${SndFile_INCLUDE_DIR})

set (SndFile_LIBRARY SndFile::sndfile)
set (SNDFILE_LIBRARY SndFile::sndfile)
set (SndFile_LIBRARIES SndFile::sndfile)
set (SNDFILE_LIBRARIES SndFile::sndfile)


check_required_components(SndFile)

set (SNDFILE_FOUND 1)

set(SndFile_VERSION @PROJECT_VERSION@)
set(SndFile_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
set(SndFile_VERSION_MINOR @PROJECT_VERSION_MINOR@)
set(SndFile_VERSION_PATCH @PROJECT_VERSION_PATCH@)

set (SndFile_WITH_EXTERNAL_LIBS @SndFile_WITH_EXTERNAL_LIBS@)

@PACKAGE_INIT@

include (CMakeFindDependencyMacro)

if (SndFile_WITH_EXTERNAL_LIBS AND NOT @BUILD_SHARED_LIBS@)
	find_dependency (Ogg 1.3)
	find_dependency (VorbisEnc)
	find_dependency (FLAC)
	find_dependency (Opus)
endif ()

include (${CMAKE_CURRENT_LIST_DIR}/SndFileTargets.cmake)

set_and_check (SndFile_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
set (SNDFILE_INCLUDE_DIR ${SndFile_INCLUDE_DIR})

set (SndFile_LIBRARY SndFile::sndfile)
set (SNDFILE_LIBRARY SndFile::sndfile)
set (SndFile_LIBRARIES SndFile::sndfile)
set (SNDFILE_LIBRARIES SndFile::sndfile)


check_required_components(SndFile)

set (SNDFILE_FOUND 1)

Fix Package Configuration file when ENABLE_EXTERNAL_LIBS is OFF
CMake: Fix Package Configuration file when ENABLE_EXTERNAL_LIBS is OFF

When libsndfile is configured with ENABLE_EXTERNAL_LIBS=OFF, the CMake
Package Configuration file shouldn't look for the external libraries.
Otherwise, the return() call in the find_dependency() macro causes
find_package(SndFile) to fail if the libraries are not found.

Furthermore, the find_dependency() calls are necessary only when
BUILD_SHARED_LIBS=OFF. In other scenarios, the external libraries aren't
linked by client projects.
