2
0

Findportaudio.cmake 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # PORTAUDIO_FOUND - system has libportaudio
  2. # PORTAUDIO_INCLUDE_DIRS - the libportaudio include directory
  3. # PORTAUDIO_LIBRARIES - Link these to use libportaudio
  4. if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
  5. # in cache already
  6. set(PORTAUDIO_FOUND TRUE)
  7. else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
  8. if(WIN32)
  9. set(PORTAUDIO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/portaudio/include")
  10. if(NOT "${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
  11. set(PORTAUDIO_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/external/portaudio/portaudio_win32.lib")
  12. else()
  13. set(PORTAUDIO_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/external/portaudio/portaudio_x64.lib")
  14. endif()
  15. else()
  16. find_path(PORTAUDIO_INCLUDE_DIR
  17. NAMES
  18. portaudio.h
  19. PATHS
  20. /usr/include
  21. /usr/local/include
  22. /opt/local/include
  23. /sw/include
  24. )
  25. find_library(PORTAUDIO_LIBRARY
  26. NAMES
  27. portaudio
  28. PATHS
  29. /usr/lib
  30. /usr/local/lib
  31. /opt/local/lib
  32. /sw/lib
  33. )
  34. endif()
  35. set(PORTAUDIO_INCLUDE_DIRS
  36. ${PORTAUDIO_INCLUDE_DIR}
  37. )
  38. set(PORTAUDIO_LIBRARIES
  39. ${PORTAUDIO_LIBRARY}
  40. )
  41. if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
  42. set(PORTAUDIO_FOUND TRUE)
  43. endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
  44. if (PORTAUDIO_FOUND)
  45. if (NOT Portaudio_FIND_QUIETLY)
  46. message(STATUS "Found libportaudio: ${PORTAUDIO_LIBRARIES}")
  47. endif (NOT Portaudio_FIND_QUIETLY)
  48. else (PORTAUDIO_FOUND)
  49. if (Portaudio_FIND_REQUIRED)
  50. message(FATAL_ERROR "Could not find libportaudio")
  51. endif (Portaudio_FIND_REQUIRED)
  52. endif (PORTAUDIO_FOUND)
  53. # show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view
  54. mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
  55. endif (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)