summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindMPG123.cmake28
-rw-r--r--cmake/FindSndFile.cmake84
-rw-r--r--cmake/Findmpg123.cmake38
3 files changed, 80 insertions, 70 deletions
diff --git a/cmake/FindMPG123.cmake b/cmake/FindMPG123.cmake
deleted file mode 100644
index a9b6dd8b..00000000
--- a/cmake/FindMPG123.cmake
+++ /dev/null
@@ -1,28 +0,0 @@
-# - Find mpg123
-# Find the native mpg123 includes and library
-#
-# MPG123_INCLUDE_DIR - where to find mpg123.h
-# MPG123_LIBRARIES - List of libraries when using mpg123.
-# MPG123_FOUND - True if mpg123 found.
-
-IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
- # Already in cache, be silent
- SET(MPG123_FIND_QUIETLY TRUE)
-ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
-
-FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
- PATHS "${MPG123_DIR}"
- PATH_SUFFIXES include
- )
-
-FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0
- PATHS "${MPG123_DIR}"
- PATH_SUFFIXES lib
- )
-
-# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR)
-
-# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR)
diff --git a/cmake/FindSndFile.cmake b/cmake/FindSndFile.cmake
index 8ae47b70..5381af48 100644
--- a/cmake/FindSndFile.cmake
+++ b/cmake/FindSndFile.cmake
@@ -4,9 +4,11 @@
#
# Once done this will define
#
-# SNDFILE_FOUND - system has libsndfile
+# SNDFILE_FOUND - system has libsndfile
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
-# SNDFILE_LIBRARIES - Link these to use libsndfile
+# SNDFILE_LIBRARIES - Link these to use libsndfile
+# SNDFILE_CFLAGS - Compile options to use libsndfile
+# SndFile::SndFile - Imported library of libsndfile
#
# Copyright (C) 2006 Wengo
#
@@ -15,53 +17,51 @@
# 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)
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+ pkg_search_module(PKG_SNDFILE "sndfile")
+endif()
- find_path(SNDFILE_INCLUDE_DIR
+find_path(SNDFILE_INCLUDE_DIR
NAMES
- sndfile.h
+ sndfile.h
+ HINTS
+ ${PKG_SNDFILE_INCLUDE_DIRS}
PATHS
- /usr/include
- /usr/local/include
- /opt/local/include
- /sw/include
- )
-
- find_library(SNDFILE_LIBRARY
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+
+find_library(SNDFILE_LIBRARY
NAMES
- sndfile
+ sndfile
+ HINTS
+ ${PKG_SNDFILE_LIBRARIES}
PATHS
- /usr/lib
- /usr/local/lib
- /opt/local/lib
- /sw/lib
- )
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+)
- set(SNDFILE_INCLUDE_DIRS
- ${SNDFILE_INCLUDE_DIR}
- )
- set(SNDFILE_LIBRARIES
- ${SNDFILE_LIBRARY}
- )
+set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile")
- if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
- set(SNDFILE_FOUND TRUE)
- endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
+set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}")
+set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}")
- 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)
+if(SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
+ set(SNDFILE_FOUND TRUE)
+endif()
- # show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view
- mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
-endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
+if(NOT TARGET SndFile::SndFile)
+ add_library(__SndFile INTERFACE)
+ target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS})
+ target_include_directories(__SndFile INTERFACE ${SNDFILE_INCLUDE_DIRS})
+ target_link_libraries(__SndFile INTERFACE ${SNDFILE_LIBRARIES})
+ add_library(SndFile::SndFile ALIAS __SndFile)
+endif()
diff --git a/cmake/Findmpg123.cmake b/cmake/Findmpg123.cmake
new file mode 100644
index 00000000..c6fe56bb
--- /dev/null
+++ b/cmake/Findmpg123.cmake
@@ -0,0 +1,38 @@
+# - Find mpg123
+# Find the native mpg123 includes and library
+#
+# mpg123_INCLUDE_DIR - Where to find mpg123.h
+# mpg123_LIBRARIES - List of libraries when using mpg123.
+# mpg123_CFLAGS - Compile options to use mpg123
+# mpg123_FOUND - True if mpg123 found.
+# MPG123::libmpg123 - Imported library of libmpg123
+
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+ pkg_search_module(PKG_MPG123 mpg123)
+endif()
+
+find_path(mpg123_INCLUDE_DIR mpg123.h
+ HINTS ${PKG_MPG123_INCLUDE_DIRS}
+ PATHS "${mpg123_DIR}"
+ PATH_SUFFIXES include
+)
+
+find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0
+ HINTS ${PKG_MPG123_LIBRARIES}
+ PATHS "${mpg123_DIR}"
+ PATH_SUFFIXES lib
+)
+
+set(mpg123_CFLAGS "${PKG_MPG123_CFLAGS_OTHER}" CACHE STRING "CFLAGS of mpg123")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(mpg123 DEFAULT_MSG mpg123_LIBRARIES mpg123_INCLUDE_DIR)
+
+if(NOT TARGET MPG123::libmpg123)
+ add_library(__libmpg123 INTERFACE)
+ target_compile_options(__libmpg123 INTERFACE ${mpg123_CFLAGS})
+ target_include_directories(__libmpg123 INTERFACE ${mpg123_INCLUDE_DIR})
+ target_link_libraries(__libmpg123 INTERFACE ${mpg123_LIBRARIES})
+ add_library(MPG123::libmpg123 ALIAS __libmpg123)
+endif()