From aad29c32d35190217cc272ebd3e25ad505e35ef7 Mon Sep 17 00:00:00 2001 From: David Anthony Date: Fri, 10 May 2024 10:55:53 -0500 Subject: [PATCH 1/2] Improved search for libgps in CMakeLists --- gpsd_client/CMakeLists.txt | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gpsd_client/CMakeLists.txt b/gpsd_client/CMakeLists.txt index a6d3778..d4f02c0 100644 --- a/gpsd_client/CMakeLists.txt +++ b/gpsd_client/CMakeLists.txt @@ -11,8 +11,25 @@ find_package(catkin REQUIRED COMPONENTS sensor_msgs ) -find_package(PkgConfig) -pkg_check_modules (libgps REQUIRED libgps) +# Try to find libgps, first with CMake's usual library search method, then by +# querying pkg-config. +find_library(libgps_LIBRARIES NAMES gps) +find_path(libgps_INCLUDE_DIRS NAMES libgpsmm.h gps.h) + +if(NOT libgps_LIBRARIES) + message(STATUS "Checking pkg-config for libgps") + find_package(PkgConfig) + if(PkgConfig_FOUND) + pkg_check_modules(libgps libgps) + endif() +endif() + +if(NOT libgps_LIBRARIES) + message(FATAL_ERROR "Could not find libgps " + "(hint for Debian/Ubuntu: apt install libgps-dev)") +else() + message(STATUS "Found libgps: ${libgps_LIBRARIES}") +endif() ################################################### ## Declare things to be passed to other projects ## From e640c85f8d2dc90843cc5742f4b47cb3c520f8dd Mon Sep 17 00:00:00 2001 From: David Anthony Date: Fri, 10 May 2024 10:58:48 -0500 Subject: [PATCH 2/2] retrigger checks