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 <mhei@heimpold.de>
This commit is contained in:
Michael Heimpold
2024-04-27 22:06:55 +02:00
parent 7e18c0e115
commit fcf8cd7a03

View File

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