aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/FindSndFile.cmake
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-03-24 13:36:49 -0700
committerChris Robinson <[email protected]>2020-03-24 13:36:49 -0700
commit586bc94d513125a63e61922ac0805a71c6ef1950 (patch)
treee16d776e93f9912dd03e720dcd3617b783a0791f /cmake/FindSndFile.cmake
parentc24d1272290313243738b646688eac2d68971be3 (diff)
Use libsndfile for the alplay example
Diffstat (limited to 'cmake/FindSndFile.cmake')
-rw-r--r--cmake/FindSndFile.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/FindSndFile.cmake b/cmake/FindSndFile.cmake
new file mode 100644
index 00000000..afeec961
--- /dev/null
+++ b/cmake/FindSndFile.cmake
@@ -0,0 +1,23 @@
+# - 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
+
+find_path(SNDFILE_INCLUDE_DIR NAMES sndfile.h)
+
+find_library(SNDFILE_LIBRARY NAMES sndfile sndfile-1)
+
+# handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
+
+if(SNDFILE_FOUND)
+ set(SNDFILE_INCLUDE_DIRS ${SNDFILE_INCLUDE_DIR})
+ set(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY})
+endif()
+
+# show the SNDFILE_INCLUDE_DIR and SNDFILE_LIBRARY variables only in the advanced view
+mark_as_advanced(SNDFILE_INCLUDE_DIR SNDFILE_LIBRARY)