Skip to content

Commit

Permalink
Updating package search
Browse files Browse the repository at this point in the history
  • Loading branch information
danthony06 committed May 9, 2024
1 parent 4e61959 commit 6d7636b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion gpsd_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d7636b

Please sign in to comment.