summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2016-03-05 14:59:14 +0100
committerFelix Fietkau <nbd@openwrt.org>2016-03-07 09:37:39 +0100
commit18c13247f9e0bfad1effc0445bcda436d03789c5 (patch)
treead83bfe0c1bd0b0764857664d695097e3aa34f94
parentd4e42a9081e0b6fa5cbb072bcbfe01adccdad694 (diff)
downloaduci-18c13247f9e0bfad1effc0445bcda436d03789c5.tar.gz
cmake: Add ubox library and include dir lookup
Otherwise cmake uses files from system which sometimes isn't wanted, ie. for testing. Signed-off-by: Petr Å tetiar <ynezz@true.cz>
-rw-r--r--CMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9decc6..a900a15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,14 +9,22 @@ OPTION(UCI_DEBUG "debugging support" OFF)
OPTION(UCI_DEBUG_TYPECAST "typecast debugging support" OFF)
OPTION(BUILD_LUA "build Lua binding" ON)
+IF(BUILD_STATIC)
+ FIND_LIBRARY(ubox_library NAMES ubox.a)
+ELSE(BUILD_STATIC)
+ FIND_LIBRARY(ubox_library NAMES ubox)
+ENDIF(BUILD_STATIC)
+
+FIND_PATH(ubox_include_dir libubox/usock.h)
+
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/uci_config.h.in ${CMAKE_SOURCE_DIR}/uci_config.h )
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${ubox_include_dir})
SET(LIB_SOURCES libuci.c file.c util.c delta.c parse.c blob.c)
ADD_LIBRARY(uci SHARED ${LIB_SOURCES})
-TARGET_LINK_LIBRARIES(uci ubox)
+TARGET_LINK_LIBRARIES(uci ${ubox_library})
SET_TARGET_PROPERTIES(uci PROPERTIES OUTPUT_NAME uci)
ADD_EXECUTABLE(cli cli.c)