From 62e6e5a0bf2beb414e52955f58dc4e69f9862f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Ekstr=C3=B6m?= Date: Fri, 22 Jul 2022 10:26:46 +0200 Subject: [PATCH] Improve CMake handling of libgpiod --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 883b624..33d974a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,11 @@ else() option(ENABLE_UDEV "use udev to search JTAG adapter from /dev/xx" ON) endif() option(ENABLE_CMSISDAP "enable cmsis DAP interface (requires hidapi)" ON) -option(ENABLE_LIBGPIOD "enable libgpiod bitbang driver (requires libgpiod)" ON) +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + option(ENABLE_LIBGPIOD "enable libgpiod bitbang driver (requires libgpiod)" ON) +else() + set(ENABLE_LIBGPIOD OFF) +endif() option(USE_PKGCONFIG "Use pkgconfig to find libraries" ON) option(LINK_CMAKE_THREADS "Use CMake find_package to link the threading library" OFF) set(ISE_PATH "/opt/Xilinx/14.7" CACHE STRING "ise root directory (default: /opt/Xilinx/14.7)") @@ -64,7 +68,7 @@ if (USE_PKGCONFIG) endif() if (ENABLE_LIBGPIOD) - pkg_check_modules(LIBGPIOD REQUIRED libgpiod) + pkg_check_modules(LIBGPIOD libgpiod) if (NOT LIBGPIOD_FOUND) message("libgpiod not found, disabling gpiod support") set(ENABLE_LIBGPIOD OFF)