diff --git a/CMakeLists.txt b/CMakeLists.txt index 368eccb..322894e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ endif() if( UNIX AND NOT APPLE ) find_package(PkgConfig REQUIRED) - pkg_check_modules(DNSSD REQUIRED avahi-compat-libdns_sd) pkg_check_modules(PLIST libplist>=2.0) if(NOT PLIST_FOUND) pkg_check_modules(PLIST REQUIRED libplist-2.0) @@ -58,7 +57,6 @@ target_link_libraries( uxplay if ( UNIX AND NOT APPLE ) target_link_directories( uxplay PUBLIC ${GST_LIBRARY_DIRS} - ${DNSSD_LIBRARY_DIRS} ${PLIST_LIBRARY_DIRS} ) target_link_libraries( uxplay ${PLIST_LIBRARIES} ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index b6f97a0..36e2f05 100755 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -74,9 +74,29 @@ elseif( APPLE ) ) endif() -#dns_sd +#dns_sd (we only need to find the dns_sd.h include file for non_Apple systems) if ( UNIX AND NOT APPLE ) - target_include_directories( airplay PUBLIC ${DNSSD_INCLUDE_DIRS} ) - link_directories( ${DNSSD_LIBRARY_DIRS} ) - target_link_libraries( airplay ${DNSSD_LIBRARIES}) + pkg_check_modules(AVAHI_COMPAT avahi-compat-libdns_sd) + if( AVAHI_COMPAT_FOUND ) + message( STATUS "AVAHI_COMPAT_INCLUDE_DIRS " ${AVAHI_COMPAT_INCLUDE_DIRS} ) + target_include_directories( airplay PUBLIC ${AVAHI_COMPAT_INCLUDE_DIRS} ) + message( STATUS "AVAHI_COMPAT_LIBRARIES " ${AVAHI_COMPAT_LIBRARIES} ) + target_link_libraries( airplay ${AVAHI_COMPAT_LIBRARIES} ) + else() # dns_sd can be provided by mdnsResponder instead of Avahi. + find_library(DNS_SD dns_sd ) + if( NOT DNS_SD ) + message( FATAL_ERROR "libdns_sd not found; suggestion: install avahi-compat-libdns-sd ") + else() + message( STATUS "libdns_sd found at " ${DNS_SD} ) + endif() + set ( INCLUDE_PATHS " /usr/include/ /usr/include/* /usr/local/include/ /usr/local/include/* " ) + find_file( DNS_SD_H dns_sd.h PATHS ${INCLUDE_PATHS} ) + if( NOT DNS_SD_H ) + message( FATAL_ERROR " dns_sd.h not found in PATHS " ${INCLUDE_PATHS}) + endif() + string( REPLACE "dns_sd.h" "" DNSSD_INCLUDE_DIR ${DNS_SD_H} ) + message( STATUS "found dns_sd.h in " ${DNSSD_INCLUDE_DIR} ) + target_include_directories( airplay PRIVATE ${DNSSD_INCLUDE_DIR} ) + target_link_libraries( airplay dns_sd ) + endif() endif()