cmake: Fix find_library for ubusd and examples/server
[project/ubus.git] / examples / CMakeLists.txt
index 5a11a9f2e0a6d3cf380a26258cd0d0ad59f2802f..81f9997529505235a363bfed9094c01963b92e1c 100644 (file)
@@ -1,10 +1,12 @@
 cmake_minimum_required(VERSION 2.6)
 
 ADD_DEFINITIONS(-I..)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
-ADD_EXECUTABLE(server server.c)
-TARGET_LINK_LIBRARIES(server ubus ubox blobmsg_json)
-
-ADD_EXECUTABLE(client client.c)
-TARGET_LINK_LIBRARIES(client ubus ubox)
+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()