From ab92ba862353cc1d76cd769b8f095e197c75538a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Wed, 27 Jul 2016 14:45:48 +0200 Subject: [PATCH] cmake: Add proper library and include files search logic for dependecies MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Petr Å tetiar --- 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 -- 2.30.2