From fcf8cd7a031a0f436bcf83b742fec9aa383f27e7 Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Sat, 27 Apr 2024 22:06:55 +0200 Subject: [PATCH] Improve cmake status messages during libgpiod detection The standard cmake messages of pkg_check_modules might be confusing when being used as here, i.e. when searching for the highest compatible version. So suppress these standard messages and print manual ones instead. Signed-off-by: Michael Heimpold --- CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7adc7ae8..ff960862 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,27 +245,33 @@ if(HAVE_LINUXGPIO) find_package(PkgConfig) if(PKG_CONFIG_FOUND) # check whether we have version >= 2.0 - pkg_check_modules(LIBGPIODV2 libgpiod>=2.0) + message(STATUS "Checking for module 'libgpiod'...") + pkg_check_modules(LIBGPIODV2 QUIET libgpiod>=2.0) if(LIBGPIODV2_FOUND) + message(STATUS "Found module 'libgpiod' (found version \"${LIBGPIODV2_VERSION}\")") set(HAVE_LIBGPIOD 1) set(HAVE_LIBGPIOD_V2 1) set(CMAKE_REQUIRED_LIBRARIES ${LIBGPIODV2_LIBRARIES}) set(LIB_LIBGPIOD ${LIBGPIODV2_LINK_LIBRARIES}) else() # check whether we have version >= 1.6 - pkg_check_modules(LIBGPIODV1_6 libgpiod>=1.6) + pkg_check_modules(LIBGPIODV1_6 QUIET libgpiod>=1.6) if(LIBGPIODV1_6_FOUND) + message(STATUS "Found module 'libgpiod' (found version \"${LIBGPIODV1_6_VERSION}\")") set(HAVE_LIBGPIOD 1) set(HAVE_LIBGPIOD_V1_6 1) set(CMAKE_REQUIRED_LIBRARIES ${LIBGPIODV1_6_LIBRARIES}) set(LIB_LIBGPIOD ${LIBGPIODV1_6_LINK_LIBRARIES}) else() # check whether we have at least an older version - pkg_check_modules(LIBGPIOD libgpiod) + pkg_check_modules(LIBGPIOD QUIET libgpiod) if(LIBGPIOD_FOUND) + message(STATUS "Found module 'libgpiod' (found version \"${LIBGPIOD_VERSION}\")") set(HAVE_LIBGPIOD 1) set(CMAKE_REQUIRED_LIBRARIES ${LIBGPIOD_LIBRARIES}) set(LIB_LIBGPIOD ${LIBGPIOD_LINK_LIBRARIES}) + else() + message(STATUS "Could not find module 'libgpiod', proceeding without.") endif() endif() endif() @@ -440,11 +446,11 @@ endif() if(HAVE_LINUXGPIO) message(STATUS "ENABLED linuxgpio") if (LIBGPIODV2_FOUND) - message(STATUS "DO HAVE libgpiod (>=2.0)") + message(STATUS "DO HAVE libgpiod (${LIBGPIODV2_VERSION})") elseif(LIBGPIODV1_6_FOUND) - message(STATUS "DO HAVE libgpiod (>=1.6)") + message(STATUS "DO HAVE libgpiod (${LIBGPIODV1_6_VERSION})") elseif(LIBGPIOD_FOUND) - message(STATUS "DO HAVE libgpiod") + message(STATUS "DO HAVE libgpiod (${LIBGPIOD_VERSION})") else() message(STATUS "DON'T HAVE libgpiod") endif()