Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add new CMake option to build without DNS-SD
On startup, Direwolf states that it includes optional support for
dns-sd. However, no option is provided in the build to exclude such
support. This means that on Linux, for example, the Avahi libraries
are always required.

This change adds a CMake option to exclude DNS-SD support, for both
Linux and Mac builds. The default is to include it, retaining the
current status. To exclude it, '-DOPTIONAL_DNSSD=OFF' can be added
to the invocation of CMake.

Fixes #451
  • Loading branch information
mfncooper committed Sep 29, 2025
commit 1f5e605e940dc682a43ba28074cf9efa385f563d
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ option(FORCE_SSSE3 "Compile with SSSE3 instruction only" OFF)
option(FORCE_SSE41 "Compile with SSE4.1 instruction only" OFF)
option(OPTIONAL_TEST "Compile optional test (might be broken)" OFF)
# UNITTEST option must be after CMAKE_BUILT_TYPE
option(OPTIONAL_DNSSD "Include support for DNS-SD" ON)

# where cmake find custom modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
Expand Down Expand Up @@ -163,9 +164,11 @@ elseif(APPLE)
set(CMAKE_MACOSX_RPATH ON)
message(STATUS "RPATH support: ${CMAKE_MACOSX_RPATH}")

# just blindly enable dns-sd
set(USE_MACOS_DNSSD ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MACOS_DNSSD")
# optionally enable dns-sd
if(OPTIONAL_DNSSD)
set(USE_MACOS_DNSSD ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MACOS_DNSSD")
endif()

elseif (WIN32)
if(C_MSVC)
Expand Down Expand Up @@ -365,9 +368,11 @@ if(LINUX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CM108")
endif()

find_package(Avahi)
if(AVAHI_CLIENT_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AVAHI_CLIENT")
if(OPTIONAL_DNSSD)
find_package(Avahi)
if(AVAHI_CLIENT_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AVAHI_CLIENT")
endif()
endif()

elseif (HAVE_SNDIO)
Expand Down
Loading