From e2c74e210588aa8f17114ee89683568dc794d725 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Thu, 22 Feb 2024 14:12:29 -0500
Subject: [PATCH] only build dvpn on Linux

Change-Id: I7027a8678919d4aae98c88b49800dac912c08ae3
---
 CMakeLists.txt | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4fb897..4297437 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)
-- 
GitLab