1 # - Try to find Portaudio
2 # Once done this will define
4 # PORTAUDIO_FOUND - system has Portaudio
5 # PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory
6 # PORTAUDIO_LIBRARIES - Link these to use Portaudio
7 # PORTAUDIO_DEFINITIONS - Compiler switches required for using Portaudio
8 # PORTAUDIO_VERSION - Portaudio version
10 # Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
12 # Redistribution and use is allowed according to the terms of the New BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
17 if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
19 set(PORTAUDIO_FOUND TRUE)
20 else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
22 include(FindPkgConfig)
23 pkg_check_modules(PORTAUDIO2 portaudio-2.0)
27 set(PORTAUDIO_INCLUDE_DIRS
28 ${PORTAUDIO2_INCLUDE_DIRS}
30 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
31 set(PORTAUDIO_LIBRARIES "${PORTAUDIO2_LIBRARY_DIRS}/lib${PORTAUDIO2_LIBRARIES}.dylib")
32 else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
33 set(PORTAUDIO_LIBRARIES
34 ${PORTAUDIO2_LIBRARIES}
36 endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
40 set(PORTAUDIO_FOUND TRUE)
41 else (PORTAUDIO2_FOUND)
42 find_path(PORTAUDIO_INCLUDE_DIR
52 find_library(PORTAUDIO_LIBRARY
62 find_path(PORTAUDIO_LIBRARY_DIR
72 set(PORTAUDIO_INCLUDE_DIRS
73 ${PORTAUDIO_INCLUDE_DIR}
75 set(PORTAUDIO_LIBRARIES
79 set(PORTAUDIO_LIBRARY_DIRS
80 ${PORTAUDIO_LIBRARY_DIR}
87 if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
88 set(PORTAUDIO_FOUND TRUE)
89 endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
92 if (NOT Portaudio_FIND_QUIETLY)
93 message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}")
94 endif (NOT Portaudio_FIND_QUIETLY)
95 else (PORTAUDIO_FOUND)
96 if (Portaudio_FIND_REQUIRED)
97 message(FATAL_ERROR "Could not find Portaudio")
98 endif (Portaudio_FIND_REQUIRED)
99 endif (PORTAUDIO_FOUND)
100 endif (PORTAUDIO2_FOUND)
103 # show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view
104 mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
106 endif (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)