diff options
author | Petr Štetiar <ynezz@true.cz> | 2021-03-19 13:42:25 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-04-23 00:42:29 +0200 |
commit | 3c2aeffa26ba720f130d2acff34139fa774cec7e (patch) | |
tree | 342a3a94f9d61150d9560fa6e453e2db0fca5dba /CMakeLists.txt | |
parent | 617a114a2c4d7cdb766bd111375237fd9cb15663 (diff) |
cmake: fix includes and libraries
So it can be built out of the tree.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e3dfe81..3a8fce0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ IF(NOT APPLE) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,--gc-sections") ENDIF() -find_library(json NAMES json-c json) +FIND_LIBRARY(json NAMES json-c json) IF(DEBUG) ADD_DEFINITIONS(-DDEBUG -g3 -O0) @@ -71,17 +71,24 @@ IF(MATH_SUPPORT) ENDIF() IF(UBUS_SUPPORT) + FIND_LIBRARY(ubus NAMES ubus) + FIND_LIBRARY(blobmsg_json NAMES blobmsg_json) + FIND_PATH(ubus_include_dir NAMES libubus.h) + INCLUDE_DIRECTORIES(${ubus_include_dir}) SET(LIBRARIES ${LIBRARIES} ubus_lib) ADD_LIBRARY(ubus_lib MODULE lib/ubus.c) SET_TARGET_PROPERTIES(ubus_lib PROPERTIES OUTPUT_NAME lib/ubus PREFIX "") - TARGET_LINK_LIBRARIES(ubus_lib ubus blobmsg_json) + TARGET_LINK_LIBRARIES(ubus_lib ${ubus} ${blobmsg_json}) ENDIF() IF(UCI_SUPPORT) + FIND_LIBRARY(uci NAMES uci) + FIND_PATH(uci_include_dir uci.h) + INCLUDE_DIRECTORIES(${uci_include_dir}) SET(LIBRARIES ${LIBRARIES} uci_lib) ADD_LIBRARY(uci_lib MODULE lib/uci.c) SET_TARGET_PROPERTIES(uci_lib PROPERTIES OUTPUT_NAME lib/uci PREFIX "") - TARGET_LINK_LIBRARIES(uci_lib uci) + TARGET_LINK_LIBRARIES(uci_lib ${uci}) ENDIF() INSTALL(TARGETS ucode RUNTIME DESTINATION bin) |