Skip to content

Commit 9c98759

Browse files
authored
Better dependency search (#108)
* Improved search for libgps in CMakeLists * retrigger checks
1 parent b944a42 commit 9c98759

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

gpsd_client/CMakeLists.txt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,25 @@ find_package(catkin REQUIRED COMPONENTS
1111
sensor_msgs
1212
)
1313

14-
find_package(PkgConfig)
15-
pkg_check_modules (libgps REQUIRED libgps)
14+
# Try to find libgps, first with CMake's usual library search method, then by
15+
# querying pkg-config.
16+
find_library(libgps_LIBRARIES NAMES gps)
17+
find_path(libgps_INCLUDE_DIRS NAMES libgpsmm.h gps.h)
18+
19+
if(NOT libgps_LIBRARIES)
20+
message(STATUS "Checking pkg-config for libgps")
21+
find_package(PkgConfig)
22+
if(PkgConfig_FOUND)
23+
pkg_check_modules(libgps libgps)
24+
endif()
25+
endif()
26+
27+
if(NOT libgps_LIBRARIES)
28+
message(FATAL_ERROR "Could not find libgps "
29+
"(hint for Debian/Ubuntu: apt install libgps-dev)")
30+
else()
31+
message(STATUS "Found libgps: ${libgps_LIBRARIES}")
32+
endif()
1633

1734
###################################################
1835
## Declare things to be passed to other projects ##

0 commit comments

Comments
 (0)