FindJack.cmake 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # - Try to find jack-2.6
  2. # Once done this will define
  3. #
  4. # JACK_FOUND - system has jack
  5. # JACK_INCLUDE_DIRS - the jack include directory
  6. # JACK_LIBRARIES - Link these to use jack
  7. # JACK_DEFINITIONS - Compiler switches required for using jack
  8. #
  9. # Copyright (c) 2008 Andreas Schneider <[email protected]>
  10. # Modified for other libraries by Lasse Kärkkäinen <tronic>
  11. #
  12. # Redistribution and use is allowed according to the terms of the New
  13. # BSD license.
  14. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  15. #
  16. if (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
  17. # in cache already
  18. set(JACK_FOUND TRUE)
  19. else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
  20. # use pkg-config to get the directories and then use these values
  21. # in the FIND_PATH() and FIND_LIBRARY() calls
  22. if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
  23. include(UsePkgConfig)
  24. pkgconfig(jack _JACK_INCLUDEDIR _JACK_LIBDIR _JACK_LDFLAGS _JACK_CFLAGS)
  25. else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
  26. find_package(PkgConfig)
  27. if (PKG_CONFIG_FOUND)
  28. pkg_check_modules(_JACK jack)
  29. endif (PKG_CONFIG_FOUND)
  30. endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
  31. find_path(JACK_INCLUDE_DIR
  32. NAMES
  33. jack/jack.h
  34. PATHS
  35. ${_JACK_INCLUDEDIR}
  36. /usr/include
  37. /usr/local/include
  38. /opt/local/include
  39. /sw/include
  40. )
  41. find_library(JACK_LIBRARY
  42. NAMES
  43. jack
  44. PATHS
  45. ${_JACK_LIBDIR}
  46. /usr/lib
  47. /usr/local/lib
  48. /opt/local/lib
  49. /sw/lib
  50. )
  51. if (JACK_LIBRARY AND JACK_INCLUDE_DIR)
  52. set(JACK_FOUND TRUE)
  53. set(JACK_INCLUDE_DIRS
  54. ${JACK_INCLUDE_DIR}
  55. )
  56. set(JACK_LIBRARIES
  57. ${JACK_LIBRARIES}
  58. ${JACK_LIBRARY}
  59. )
  60. endif (JACK_LIBRARY AND JACK_INCLUDE_DIR)
  61. if (JACK_FOUND)
  62. if (NOT JACK_FIND_QUIETLY)
  63. message(STATUS "Found jack: ${JACK_LIBRARY}")
  64. endif (NOT JACK_FIND_QUIETLY)
  65. else (JACK_FOUND)
  66. if (JACK_FIND_REQUIRED)
  67. message(FATAL_ERROR "Could not find JACK")
  68. endif (JACK_FIND_REQUIRED)
  69. endif (JACK_FOUND)
  70. # show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view
  71. mark_as_advanced(JACK_INCLUDE_DIRS JACK_LIBRARIES)
  72. endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)