supernova: jack backend - improve xrun handling
[supercollider.git] / cmake_modules / FindCWiid.cmake
blob87baed5efa7998cdbb2ccf7733f338b9ca28a444
1 # Try to find CWiid
2 #  CWIID_FOUND - If false, do not try to use CWiid.
3 #  CWIID_INCLUDE_DIRS - where to find cwiid.h
4 #  CWIID_LIBRARIES - the libraries to link against
6 find_package(Bluetooth)
8 if (CWIID_LIBRARIES AND CWIID_INCLUDE_DIRS AND BLUETOOTH_FOUND)
9         # path set by user or was found in the past
10         set(CWIID_FOUND TRUE)
11 else (CWIID_LIBRARIES AND CWIID_INCLUDE_DIRS AND BLUETOOTH_FOUND)
12         find_path(CWIID_INCLUDE_DIRS
13                 NAMES cwiid.h
14         )
16         find_library(CWIID_LIBRARY
17                 NAMES cwiid
18         )
20         set(CWIID_LIBRARIES ${BLUETOOTH_LIBRARIES} ${CWIID_LIBRARY})
22         if (CWIID_INCLUDE_DIRS AND CWIID_LIBRARIES AND BLUETOOTH_FOUND)
23                 set(CWIID_FOUND TRUE)
24         endif (CWIID_INCLUDE_DIRS AND CWIID_LIBRARIES AND BLUETOOTH_FOUND)
26         if (CWIID_FOUND)
27                 if (NOT CWIID_FIND_QUIETLY)
28                         message(STATUS "Found CWiid: ${CWIID_LIBRARIES}")
29                 endif (NOT CWIID_FIND_QUIETLY)
30         else (CWIID_FOUND)
31                 if (CWIID_FIND_REQUIRED)
32                         if (NOT BLUETOOTH_FOUND)
33                                 message(FATAL_ERROR "Could not find dependency Bluetooth for CWiid")
34                         else (NOT BLUETOOTH_FOUND)
35                                 message(FATAL_ERROR "Could not find CWiid")
36                         endif (NOT BLUETOOTH_FOUND)
37                 endif (CWIID_FIND_REQUIRED)
38         endif (CWIID_FOUND)
40         # set visibility in cache
41         mark_as_advanced(CWIID_INCLUDE_DIRS CWIID_LIBRARY CWIID_LIBRARIES)
43 endif (CWIID_LIBRARIES AND CWIID_INCLUDE_DIRS AND BLUETOOTH_FOUND)