summaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorPeter A. Bigot <pab@pabigot.com>2014-05-10 07:53:06 -0500
committerJohnathan Corgan <johnathan@corganlabs.com>2014-05-16 15:07:31 -0700
commit7f783624dc36b55ba3b217c13e1bdb09ebdf198b (patch)
tree0427f306c1dc0453f9b462c828c766ea65d0d959 /cmake/Modules
parent2136cda19f8629fc7c3fda67805515dab0e41c90 (diff)
cmake: fix FindPortaudio to reject unsupported API version
portaudio18 passes the generic test for locating portaudio, but will fail when building gr-audio. Test for the failure before accepting the portaudio that was found. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/FindPortaudio.cmake21
1 files changed, 19 insertions, 2 deletions
diff --git a/cmake/Modules/FindPortaudio.cmake b/cmake/Modules/FindPortaudio.cmake
index e28858b0ed..20145ea8df 100644
--- a/cmake/Modules/FindPortaudio.cmake
+++ b/cmake/Modules/FindPortaudio.cmake
@@ -31,5 +31,22 @@ find_library(PORTAUDIO_LIBRARIES
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+# Found PORTAUDIO, but it may be version 18 which is not acceptable.
+if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h)
+ include(CheckCXXSourceCompiles)
+ include(CMakePushCheckState)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_INCLUDES ${PORTAUDIO_INCLUDE_DIRS})
+ CHECK_CXX_SOURCE_COMPILES(
+ "#include <portaudio.h>\nPaDeviceIndex pa_find_device_by_name(const char *name); int main () {return 0;}"
+ PORTAUDIO2_FOUND)
+ cmake_pop_check_state()
+ if(PORTAUDIO2_FOUND)
+ INCLUDE(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+ else(PORTAUDIO2_FOUND)
+ message(STATUS
+ " portaudio.h not compatible (requires API 2.0)")
+ set(PORTAUDIO_FOUND FALSE)
+ endif(PORTAUDIO2_FOUND)
+endif()