diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4fb89703051926f03387cc511153b734d4503f4..4297437a04a90f03a6911e0bc64d42e8245fb047 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -307,14 +307,17 @@ if (BUILD_TOOLS AND NOT MSVC)
     target_include_directories(dsh PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tools)
     install(TARGETS dsh RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 
-    add_executable(dvpn
-        tools/dvpn/main.cpp
-        tools/dvpn/dvpn.cpp
-        tools/common.cpp
-        tools/dhtnet_crtmgr/dhtnet_crtmgr.cpp)
-    target_link_libraries(dvpn PRIVATE dhtnet fmt::fmt yaml-cpp)
-    target_include_directories(dvpn PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tools)
-    install(TARGETS dvpn RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+    # dvpn is a Linux-only tool
+    if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+        add_executable(dvpn
+            tools/dvpn/main.cpp
+            tools/dvpn/dvpn.cpp
+            tools/common.cpp
+            tools/dhtnet_crtmgr/dhtnet_crtmgr.cpp)
+        target_link_libraries(dvpn PRIVATE dhtnet fmt::fmt yaml-cpp)
+        target_include_directories(dvpn PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tools)
+        install(TARGETS dvpn RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+    endif()
 
     find_library(READLINE_LIBRARIES readline)
     find_path(READLINE_INCLUDE_DIR readline/readline.h)