[OpenWrt-Devel] [PATCH 1/2] Add pkg-config for libnl (3.2) and json-c (0.12) in CMakeLists.txt
John Crispin
blogic at openwrt.org
Wed Mar 11 11:30:56 EDT 2015
Hi,
can you also rebase this patch on the recent CMakeList change i made in
netifd and resend the patch
John
On 06/03/2015 11:41, Simon Hoinkis wrote:
> ---
> CMakeLists.txt | 17 +++++++++--------
> handler.h | 2 +-
> 2 files changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index e648b03..8075b25 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -5,6 +5,13 @@ ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations)
>
> SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
>
> +INCLUDE(FindPkgConfig)
> +PKG_CHECK_MODULES(JSONC json-c)
> +INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
> +
> +PKG_SEARCH_MODULE(LIBNL libnl-3.0 libnl-3 libnl nl-3 nl)
> +INCLUDE_DIRECTORIES(${LIBNL_INCLUDE_DIRS})
> +
> IF(APPLE)
> INCLUDE_DIRECTORIES(/opt/local/include)
> LINK_DIRECTORIES(/opt/local/lib)
> @@ -17,19 +24,13 @@ SET(SOURCES
> config.c device.c bridge.c vlan.c alias.c
> macvlan.c ubus.c vlandev.c wireless.c)
>
> -
> -find_library(json NAMES json-c json)
> +find_library(json NAMES json-c)
> SET(LIBS
> ubox ubus uci ${json} blobmsg_json)
>
> -IF (NOT DEFINED LIBNL_LIBS)
> - FIND_LIBRARY(libnl NAMES libnl-3 libnl nl-3 nl)
> - SET(LIBNL_LIBS ${libnl})
> -ENDIF()
>
> IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT DUMMY_MODE)
> SET(SOURCES ${SOURCES} system-linux.c)
> - SET(LIBS ${LIBS} ${LIBNL_LIBS})
> ELSE()
> ADD_DEFINITIONS(-DDUMMY_MODE=1)
> SET(SOURCES ${SOURCES} system-dummy.c)
> @@ -45,7 +46,7 @@ ENDIF()
>
> ADD_EXECUTABLE(netifd ${SOURCES})
>
> -TARGET_LINK_LIBRARIES(netifd ${LIBS})
> +TARGET_LINK_LIBRARIES(netifd ${LIBS} ${LIBNL_LIBRARIES})
>
> INSTALL(TARGETS netifd
> RUNTIME DESTINATION sbin
> diff --git a/handler.h b/handler.h
> index e96c05a..e3e2af5 100644
> --- a/handler.h
> +++ b/handler.h
> @@ -15,7 +15,7 @@
> #define __NETIFD_HANDLER_H
>
> #include <libubox/blobmsg_json.h>
> -#include <json/json.h>
> +#include <json-c/json.h>
> #include "config.h"
>
> typedef void (*script_dump_cb)(const char *script, const char *name, json_object *obj);
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list