1project(lws-minimal-dbus-client C) 2cmake_minimum_required(VERSION 2.8.12) 3find_package(libwebsockets CONFIG REQUIRED) 4list(APPEND CMAKE_MODULE_PATH ${LWS_CMAKE_DIR}) 5include(CheckCSourceCompiles) 6include(CheckLibraryExists) 7include(LwsCheckRequirements) 8 9set(SAMP lws-minimal-dbus-client) 10set(SRCS minimal-dbus-client.c) 11 12set(requirements 1) 13require_lws_config(LWS_ROLE_DBUS 1 requirements) 14require_lws_config(LWS_WITH_CLIENT 1 requirements) 15 16if (NOT MSVC AND NOT WIN32 AND requirements) 17 add_executable(${SAMP} ${SRCS}) 18 19 if (NOT LWS_PLAT_FREERTOS) 20 find_package(PkgConfig QUIET) 21 pkg_check_modules(PC_DBUS1 dbus-1 QUIET) 22 list(APPEND LWS_DBUS_INCLUDE1 ${PC_DBUS1_INCLUDE_DIRS}) 23 list(APPEND LWS_DBUS_LIB "${PC_DBUS1_LIBRARIES};dl") 24 endif() 25 26 if (LWS_DBUS_INCLUDE1) 27 include_directories("${LWS_DBUS_INCLUDE1}") 28 endif() 29 30 if (websockets_shared) 31 target_link_libraries(${SAMP} websockets_shared ${LIBWEBSOCKETS_DEP_LIBS}) 32 add_dependencies(${SAMP} websockets_shared ${LWS_DBUS_LIB}) 33 else() 34 target_link_libraries(${SAMP} websockets ${LWS_DBUS_LIB} ${LIBWEBSOCKETS_DEP_LIBS}) 35 endif() 36endif() 37