diff mbox series

[uhttpd,1/3] cmake: Use variables

Message ID 20210101011759.21086-1-hauke@hauke-m.de
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [uhttpd,1/3] cmake: Use variables | expand

Commit Message

Hauke Mehrtens Jan. 1, 2021, 1:17 a.m. UTC
This makes it easier to build this outside of OpenWrt.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 CMakeLists.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ae8ba4..61a3315 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,9 +35,13 @@  IF(HAVE_SHADOW)
     ADD_DEFINITIONS(-DHAVE_SHADOW)
 ENDIF()
 
+FIND_LIBRARY(ubox NAMES ubox)
+FIND_LIBRARY(json_script NAMES json_script)
+FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
+
 ADD_EXECUTABLE(uhttpd ${SOURCES})
 FIND_LIBRARY(libjson NAMES json-c json)
-TARGET_LINK_LIBRARIES(uhttpd ubox dl json_script blobmsg_json ${libjson} ${LIBS})
+TARGET_LINK_LIBRARIES(uhttpd ${ubox} dl ${json_script} ${blobmsg_json} ${libjson} ${LIBS})
 
 SET(PLUGINS "")
 IF(LUA_SUPPORT)
@@ -70,10 +74,11 @@  IF(LUA_SUPPORT)
 ENDIF()
 
 IF(UBUS_SUPPORT)
+	FIND_LIBRARY(ubus NAMES ubus)
 	SET(PLUGINS ${PLUGINS} uhttpd_ubus)
 	ADD_DEFINITIONS(-DHAVE_UBUS)
 	ADD_LIBRARY(uhttpd_ubus MODULE ubus.c)
-	TARGET_LINK_LIBRARIES(uhttpd_ubus ubus ubox blobmsg_json ${libjson})
+	TARGET_LINK_LIBRARIES(uhttpd_ubus ${ubus} ${ubox} ${blobmsg_json} ${libjson})
 ENDIF()
 
 IF(PLUGINS)