cmake: fix include dirs and libs lookup
authorPetr Štetiar <ynezz@true.cz>
Thu, 26 Sep 2019 04:29:52 +0000 (06:29 +0200)
committerPetr Štetiar <ynezz@true.cz>
Mon, 31 Aug 2020 06:30:32 +0000 (08:30 +0200)
In order to make it compile properly in more environments.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
CMakeLists.txt

index a52e5bd015beebfb871a789514a82d1cdddec547..8be878dd2cd813ca1dbfc5f123ae60bf1628aa7b 100644 (file)
@@ -7,7 +7,16 @@ SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
 
 SET(SOURCES main.c dns.c announce.c cache.c service.c util.c ubus.c interface.c)
 
-SET(LIBS ubox ubus resolv blobmsg_json json-c)
+FIND_PATH(ubox_include_dir NAMES libubox/usock.h)
+FIND_PATH(ubus_include_dir NAMES libubus.h)
+INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir})
+
+FIND_LIBRARY(ubox NAMES ubox)
+FIND_LIBRARY(ubus NAMES ubus)
+FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
+FIND_LIBRARY(json NAMES json json-c)
+
+SET(LIBS ${ubox} ${ubus} ${blobmsg_json} ${json} resolv)
 
 IF(DEBUG)
   ADD_DEFINITIONS(-DDEBUG -g3)