re3/cmake/FindSndFile.cmake

68 lines
1.6 KiB
CMake
Raw Normal View History

2020-10-31 22:14:28 +00:00
# Found on http://hg.kvats.net
#
# - Try to find libsndfile
#
# Once done this will define
#
# SNDFILE_FOUND - system has libsndfile
2020-10-31 22:14:28 +00:00
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
# SNDFILE_LIBRARIES - Link these to use 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.
#
if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
# in cache already
set(SNDFILE_FOUND TRUE)
else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
2020-10-31 22:14:28 +00:00
find_path(SNDFILE_INCLUDE_DIR
2020-10-31 22:14:28 +00:00
NAMES
sndfile.h
2020-10-31 22:14:28 +00:00
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(SNDFILE_LIBRARY
2020-10-31 22:14:28 +00:00
NAMES
sndfile
2020-10-31 22:14:28 +00:00
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
2020-10-31 22:14:28 +00:00
set(SNDFILE_INCLUDE_DIRS
${SNDFILE_INCLUDE_DIR}
)
set(SNDFILE_LIBRARIES
${SNDFILE_LIBRARY}
)
2020-10-31 22:14:28 +00:00
if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
2021-01-13 11:45:10 +00:00
set(SNDFILE_FOUND TRUE)
endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
if (SNDFILE_FOUND)
if (NOT SndFile_FIND_QUIETLY)
message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}")
endif (NOT SndFile_FIND_QUIETLY)
else (SNDFILE_FOUND)
if (SndFile_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libsndfile")
endif (SndFile_FIND_REQUIRED)
endif (SNDFILE_FOUND)
2020-10-31 22:14:28 +00:00
# show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view
mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
2020-10-31 22:14:28 +00:00
endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)