rework CMakeLists.txt to try to deal with case where mDNSResponder is used

(instead of avahi)
This commit is contained in:
fduncanh
2021-11-23 01:00:12 -05:00
parent 8d9fe57c33
commit ac2d6e88df
2 changed files with 24 additions and 6 deletions

View File

@@ -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} )

View File

@@ -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()