Improve CMake handling of libgpiod

This commit is contained in:
Niklas Ekström 2022-07-22 10:26:46 +02:00
parent bb6d286736
commit 62e6e5a0bf
1 changed files with 6 additions and 2 deletions

View File

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