summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Štetiar2019-09-17 13:31:08 +0000
committerPetr Štetiar2019-12-16 08:09:18 +0000
commitfa0bf4ef45b122b21bea2397d10c47f8f874cb7f (patch)
tree44ae2106ed7ee0f2b0476fc649b85f523ab39484
parente4bd927cc7c756de5f3005824b63a7a6d827e1ee (diff)
downloaducert-fa0bf4ef45b122b21bea2397d10c47f8f874cb7f.tar.gz
cmake: add proper include and library dependencies
Otherwise it's not possible to compile it properly if the dependencies are not installed in the standard include/libraries paths. Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r--CMakeLists.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c81184..14888ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,13 @@ ADD_DEFINITIONS(-Os -ggdb -Wall --std=gnu99 -Wmissing-declarations)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-find_library(json NAMES json-c json)
+FIND_PATH(ubox_include_dir NAMES libubox/usock.h)
+FIND_PATH(jsonc_include_dir NAMES json-c/json.h)
+INCLUDE_DIRECTORIES(${ubox_include_dir} ${jsonc_include_dir})
+
+FIND_LIBRARY(ubox NAMES ubox)
+FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
+FIND_LIBRARY(json NAMES json-c json)
IF(UCERT_HOST_BUILD)
ADD_DEFINITIONS(-DUCERT_HOST_BUILD)
@@ -19,10 +25,10 @@ ENDIF()
ADD_EXECUTABLE(ucert ucert.c usign-exec.c)
IF(UCERT_FULL)
ADD_DEFINITIONS(-DUCERT_FULL)
-TARGET_LINK_LIBRARIES(ucert ubox blobmsg_json ${json})
+TARGET_LINK_LIBRARIES(ucert ${ubox} ${blobmsg_json} ${json})
ELSE()
ADD_DEFINITIONS(-DUCERT_STRIP_MESSAGES)
-TARGET_LINK_LIBRARIES(ucert ubox)
+TARGET_LINK_LIBRARIES(ucert ${ubox})
ENDIF()
INSTALL(TARGETS ucert RUNTIME DESTINATION bin)