Skip to content

Commit

Permalink
Better dependency search (#108)
Browse files Browse the repository at this point in the history
* Improved search for libgps in CMakeLists

* retrigger checks
  • Loading branch information
danthony06 authored May 10, 2024
1 parent b944a42 commit 9c98759
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions gpsd_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##
Expand Down

0 comments on commit 9c98759

Please sign in to comment.