cmake: Link against libjson-c
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 1 Jul 2016 23:06:42 +0000 (16:06 -0700)
committerJohn Crispin <john@phrozen.org>
Fri, 1 Jul 2016 13:25:47 +0000 (15:25 +0200)
block uses libblob_msgjson which requires us to link against libjson-c.
Some external toolchains would be failing to find that library unless
specified explicitly.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
CMakeLists.txt

index 9a5a583c46bf8c72b116f6c5ca102374d3af7702..7db28c0ab2ad10e40c527d8d098063a577dcf75c 100644 (file)
@@ -53,12 +53,14 @@ ADD_EXECUTABLE(mount_root mount_root.c)
 TARGET_LINK_LIBRARIES(mount_root fstools)
 INSTALL(TARGETS mount_root RUNTIME DESTINATION sbin)
 
+find_library(json NAMES json-c json)
+
 ADD_EXECUTABLE(block block.c)
 IF(DEFINED CMAKE_UBIFS_EXTROOT)
        ADD_DEFINITIONS(-DUBIFS_EXTROOT)
-       TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json ubi-utils)
+       TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json ubi-utils ${json})
 ELSE(DEFINED CMAKE_UBIFS_EXTROOT)
-       TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json)
+       TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json ${json})
 ENDIF(DEFINED CMAKE_UBIFS_EXTROOT)
 INSTALL(TARGETS block RUNTIME DESTINATION sbin)