[LEDE-DEV] [PATCH ugps 1/7] cmake: Add proper library and include files search logic for dependecies

Petr Štetiar ynezz at true.cz
Wed Jul 27 05:45:48 PDT 2016


Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 CMakeLists.txt | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 326e649..7fe7a16 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,15 +7,19 @@ SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
 
 SET(SOURCES main.c nmea)
 
-SET(LIBS ubox ubus)
-
 IF(DEBUG)
   ADD_DEFINITIONS(-DDEBUG -g3)
 ENDIF()
 
+FIND_LIBRARY(ubus NAMES ubus)
+FIND_LIBRARY(ubox NAMES ubox)
+FIND_PATH(ubus_include_dir NAMES libubus.h)
+FIND_PATH(ubox_include_dir NAMES libubox/usock.h)
+INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir})
+
 ADD_EXECUTABLE(ugps ${SOURCES})
 
-TARGET_LINK_LIBRARIES(ugps ${LIBS})
+TARGET_LINK_LIBRARIES(ugps ${ubox} ${ubus})
 
 INSTALL(TARGETS ugps
 	RUNTIME DESTINATION sbin
-- 
1.9.1




More information about the Lede-dev mailing list