summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2019-12-29 15:56:43 +0100
committerPetr Štetiar <ynezz@true.cz>2020-01-05 11:45:25 +0100
commit4fde955062433d76f0601e0cd86219ce0a2f908a (patch)
tree06f5916ec58513b4ef42f30b8c2ea3f021375e5f
parent5ed190aae1b3985719046f4c744e311fc9ef18e3 (diff)
downloadprocd-4fde955062433d76f0601e0cd86219ce0a2f908a.tar.gz
cmake: fix lookup of external libraries
In order to make it compile properly in more environments. Tested-by: Petr Novák <petrn@me.com> Tested-by: Kuan-Yi Li <kyli@abysm.org> Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r--CMakeLists.txt14
-rw-r--r--upgraded/CMakeLists.txt2
2 files changed, 11 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b3eebd..a566acd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,13 @@ IF(NOT DISABLE_INIT)
SET(SOURCES ${SOURCES} watchdog.c plug/coldplug.c plug/hotplug.c)
ENDIF()
-SET(LIBS ubox ubus json-c blobmsg_json json_script)
+FIND_LIBRARY(ubox NAMES ubox)
+FIND_LIBRARY(ubus NAMES ubus)
+FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
+FIND_LIBRARY(json_script NAMES json_script)
+FIND_LIBRARY(json NAMES json-c json)
+
+SET(LIBS ${ubox} ${ubus} ${json} ${blobmsg_json} ${json_script})
IF(DEBUG)
ADD_DEFINITIONS(-DUDEV_DEBUG -g3)
@@ -90,7 +96,7 @@ ADD_CUSTOM_TARGET(capabilities-names-h DEPENDS capabilities-names.h)
IF(SECCOMP_SUPPORT)
ADD_DEFINITIONS(-DSECCOMP_SUPPORT)
ADD_LIBRARY(preload-seccomp SHARED jail/preload.c jail/seccomp.c)
-TARGET_LINK_LIBRARIES(preload-seccomp dl ubox blobmsg_json)
+TARGET_LINK_LIBRARIES(preload-seccomp dl ${ubox} ${blobmsg_json})
INSTALL(TARGETS preload-seccomp
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
@@ -99,7 +105,7 @@ endif()
IF(JAIL_SUPPORT)
ADD_EXECUTABLE(ujail jail/jail.c jail/elf.c jail/fs.c jail/capabilities.c)
-TARGET_LINK_LIBRARIES(ujail ubox blobmsg_json)
+TARGET_LINK_LIBRARIES(ujail ${ubox} ${blobmsg_json})
INSTALL(TARGETS ujail
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
)
@@ -108,7 +114,7 @@ endif()
IF(UTRACE_SUPPORT)
ADD_EXECUTABLE(utrace trace/trace.c)
-TARGET_LINK_LIBRARIES(utrace ubox ${json} blobmsg_json)
+TARGET_LINK_LIBRARIES(utrace ${ubox} ${json} ${blobmsg_json})
INSTALL(TARGETS utrace
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
)
diff --git a/upgraded/CMakeLists.txt b/upgraded/CMakeLists.txt
index fd7d6bb..09cf472 100644
--- a/upgraded/CMakeLists.txt
+++ b/upgraded/CMakeLists.txt
@@ -5,7 +5,7 @@ FIND_PATH(ubox_include_dir libubox/uloop.h)
INCLUDE_DIRECTORIES(${ubox_include_dir})
ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
ADD_EXECUTABLE(upgraded upgraded.c ../watchdog.c)
-TARGET_LINK_LIBRARIES(upgraded ubox)
+TARGET_LINK_LIBRARIES(upgraded ${ubox})
INSTALL(TARGETS upgraded
RUNTIME DESTINATION sbin
)