4 # Finds the Shairplay library
6 # This will define the following target:
8 # Shairplay::Shairplay - The Shairplay library
10 if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
12 find_path(SHAIRPLAY_INCLUDE_DIR shairplay/raop.h)
13 find_library(SHAIRPLAY_LIBRARY NAMES shairplay libshairplay)
15 include(FindPackageHandleStandardArgs)
16 find_package_handle_standard_args(Shairplay
17 REQUIRED_VARS SHAIRPLAY_LIBRARY SHAIRPLAY_INCLUDE_DIR)
20 include(CheckCSourceCompiles)
21 set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIR})
22 set(CMAKE_REQUIRED_LIBRARIES ${SHAIRPLAY_LIBRARIES})
23 check_c_source_compiles("#include <shairplay/raop.h>
27 struct raop_callbacks_s foo;
31 " HAVE_SHAIRPLAY_CALLBACK_CLS)
32 unset(CMAKE_REQUIRED_INCLUDES)
33 unset(CMAKE_REQUIRED_LIBRARIES)
35 if(HAVE_SHAIRPLAY_CALLBACK_CLS)
36 add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
37 set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
38 IMPORTED_LOCATION "${SHAIRPLAY_LIBRARY}"
39 INTERFACE_INCLUDE_DIRECTORIES "${SHAIRPLAY_INCLUDE_DIR}"
40 INTERFACE_COMPILE_DEFINITIONS HAS_AIRTUNES)