aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-07-29 12:52:12 +0200
committerJörg Mayer <jmayer@loplof.de>2014-07-30 15:45:33 +0000
commit54777bf31566e0e72e9204fd0d60bfbe8521d6c3 (patch)
treeee347a087edc8257bdf93f0cf49f316d8fb892c3 /cmake
parentede5a9d4c0364c184bb79786128244343b0abe06 (diff)
Fix cmake build for portaudio V18
Note that the cache file (CMakeCache.txt) must be cleared when the include or library paths change, otherwise the cached result of CHECK_FUNCTION_EXISTS will be re-used. Change-Id: Ia18ed4f1b6b162499aeae6e66f612a4945390c2a Reviewed-on: https://code.wireshark.org/review/3245 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindPORTAUDIO.cmake18
1 files changed, 17 insertions, 1 deletions
diff --git a/cmake/modules/FindPORTAUDIO.cmake b/cmake/modules/FindPORTAUDIO.cmake
index 6478313e46..fd456358c0 100644
--- a/cmake/modules/FindPORTAUDIO.cmake
+++ b/cmake/modules/FindPORTAUDIO.cmake
@@ -20,7 +20,7 @@ FIND_PATH(PORTAUDIO_INCLUDE_DIR portaudio.h HINTS "${PORTAUDIO_HINTS}/include" )
SET(PORTAUDIO_NAMES portaudio)
FIND_LIBRARY(PORTAUDIO_LIBRARY NAMES ${PORTAUDIO_NAMES} )
-# handle the QUIETLY and REQUIRED arguments and set PORTAUDIO_FOUND to TRUE if
+# handle the QUIETLY and REQUIRED arguments and set PORTAUDIO_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_LIBRARY PORTAUDIO_INCLUDE_DIR)
@@ -28,6 +28,22 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_LIBRARY PORTAU
IF(PORTAUDIO_FOUND)
SET( PORTAUDIO_LIBRARIES ${PORTAUDIO_LIBRARY} )
SET( PORTAUDIO_INCLUDE_DIRS ${PORTAUDIO_INCLUDE_DIR} )
+
+ # Check for newer PortAudio V19 API
+ # http://www.portaudio.com/docs/proposals/018-VersionInformationInterface.html
+ INCLUDE(CheckFunctionExists)
+ SET(CMAKE_REQUIRED_INCLUDES ${PORTAUDIO_INCLUDE_DIRS})
+ SET(CMAKE_REQUIRED_LIBRARIES ${PORTAUDIO_LIBRARIES})
+ CHECK_FUNCTION_EXISTS(Pa_GetVersion HAVE_PA_GETVERSION)
+ SET(CMAKE_REQUIRED_INCLUDES "")
+ SET(CMAKE_REQUIRED_LIBRARIES "")
+ IF(HAVE_PA_GETVERSION)
+ # Symbol found, must be the newer V19 API
+ SET( PORTAUDIO_API_1 )
+ ELSE(HAVE_PA_GETVERSION)
+ # Symbol not found, must be the older V18 API
+ SET( PORTAUDIO_API_1 1 )
+ ENDIF(HAVE_PA_GETVERSION)
ELSE(PORTAUDIO_FOUND)
SET( PORTAUDIO_LIBRARIES )
SET( PORTAUDIO_INCLUDE_DIRS )