ubus/examples/CMakeLists.txt
Florian Fainelli 053be7df87 cmake: Fix find_library for ubusd and examples/server
Both ubusd and cli TARGET_LINK_LIBRARIES reference ${json} which is
obtained via find_library(), but since the find_library() is searched
after the TARGET_LINK_LIBRARIES for ubusd, ubusd always gets an empty
${json} variable.

examples/server also links against libjson-c, but we were not setting
TARGET_LINK_LIBRARIES accordingly, so do that too with ${json} appended.

This was causing linking errors for ubusd and then examples/server using
an external toolchain (stbgcc-4.8-1.x).

Fixes: 9f52d1769b ("cli: use the new json-c library name")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
2016-07-01 15:12:28 +02:00

12 lines
351 B
CMake

cmake_minimum_required(VERSION 2.6)
ADD_DEFINITIONS(-I..)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
IF (BUILD_EXAMPLES)
ADD_EXECUTABLE(server server.c count.c)
TARGET_LINK_LIBRARIES(server ubus ${ubox_library} ${blob_library} ${json})
ADD_EXECUTABLE(client client.c count.c)
TARGET_LINK_LIBRARIES(client ubus ${ubox_library})
ENDIF()