diff mbox series

[netifd,1/4] build: find and use libnl header dirs

Message ID 20201021030825.93626-2-yszhou4tech@gmail.com
State Accepted
Delegated to: Yousong Zhou
Headers show
Series order by address index in ubus output | expand

Commit Message

Yousong Zhou Oct. 21, 2020, 3:08 a.m. UTC
Name of the libnl .pc file is libnl-3.0.pc

This commit is mainly for testing netifd build of usual Linux systems.
netifd Makefile in current OpenWrt build system specifies custom cmake
flags to point to libnl-tiny

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 CMakeLists.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6203aa..9d19817 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,8 +27,12 @@  SET(LIBS
 	ubox ubus uci json-c blobmsg_json)
 
 IF (NOT DEFINED LIBNL_LIBS)
-  FIND_LIBRARY(libnl NAMES libnl-3 libnl nl-3 nl)
-  SET(LIBNL_LIBS ${libnl})
+	include(FindPkgConfig)
+	pkg_search_module(LIBNL libnl-3.0 libnl-3 libnl nl-3 nl)
+	IF (LIBNL_FOUND)
+		include_directories(${LIBNL_INCLUDE_DIRS})
+		SET(LIBNL_LIBS ${LIBNL_LIBRARIES})
+	ENDIF()
 ENDIF()
 
 IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT DUMMY_MODE)