From 6d7636b4e25799679022ec498849ee7b5bf90d7e Mon Sep 17 00:00:00 2001 From: David Anthony Date: Thu, 9 May 2024 15:51:24 -0500 Subject: [PATCH 1/2] Updating package search --- gpsd_client/CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gpsd_client/CMakeLists.txt b/gpsd_client/CMakeLists.txt index 3e50c75..a084c18 100644 --- a/gpsd_client/CMakeLists.txt +++ b/gpsd_client/CMakeLists.txt @@ -10,8 +10,26 @@ find_package(rclcpp REQUIRED) find_package(rclcpp_components REQUIRED) find_package(sensor_msgs REQUIRED) -find_package(PkgConfig REQUIRED) +# Try to find libgps, first with CMake's usual library search method, then by pkg_check_modules (libgps REQUIRED libgps) +# 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() add_library(${PROJECT_NAME} SHARED src/client.cpp From 403cefc807eea8219ea36d5d6685b664be0dd775 Mon Sep 17 00:00:00 2001 From: David Anthony Date: Thu, 9 May 2024 17:31:17 -0500 Subject: [PATCH 2/2] Removing pkg_check_modules call --- gpsd_client/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/gpsd_client/CMakeLists.txt b/gpsd_client/CMakeLists.txt index a084c18..8aa513f 100644 --- a/gpsd_client/CMakeLists.txt +++ b/gpsd_client/CMakeLists.txt @@ -11,7 +11,6 @@ find_package(rclcpp_components REQUIRED) find_package(sensor_msgs REQUIRED) # Try to find libgps, first with CMake's usual library search method, then by -pkg_check_modules (libgps REQUIRED libgps) # querying pkg-config. find_library(libgps_LIBRARIES NAMES gps) find_path(libgps_INCLUDE_DIRS NAMES libgpsmm.h gps.h)