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)
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)