summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-01-01 02:17:57 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2022-06-29 01:43:33 +0200
commit8ba0b640aed7df39f2ce6d4c2182207b3294849e (patch)
tree0924b41081bb7308e94d26e0bf4f6afd93aaa021
parentd59d732a10a4a2b9f18af6dfc3facf696108f31e (diff)
downloaduhttpd2-8ba0b640aed7df39f2ce6d4c2182207b3294849e.tar.gz
cmake: use variables and find_library for dependency
Use FIND_LIBRARY to search the dependency and use variables to reference them in the CMakeLists file. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> [ improve commit description ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--CMakeLists.txt9
1 files changed, 7 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 564842d..58eb6dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,9 +36,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)
@@ -78,10 +82,11 @@ IF(UCODE_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)