project(lws-minimal-dbus-ws-proxy-testclient C)
cmake_minimum_required(VERSION 3.10)
find_package(libwebsockets CONFIG REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${LWS_CMAKE_DIR})
include(CheckCSourceCompiles)
include(CheckLibraryExists)
include(LwsCheckRequirements)

set(requirements 1)
require_lws_config(LWS_ROLE_DBUS 1 requirements)
require_lws_config(LWS_WITH_CLIENT 1 requirements)

if (NOT MSVC AND NOT WIN32 AND requirements)
	add_executable(${PROJECT_NAME} minimal-dbus-ws-proxy-testclient.c)

	if (NOT LWS_PLAT_FREERTOS)
		find_package(PkgConfig QUIET)
		pkg_check_modules(PC_DBUS1 dbus-1 QUIET)
		list(APPEND LWS_DBUS_INCLUDE1 ${PC_DBUS1_INCLUDE_DIRS})
		list(APPEND LWS_DBUS_LIB "${PC_DBUS1_LIBRARIES};dl")
	endif()

	if (LWS_DBUS_INCLUDE1)
		include_directories("${LWS_DBUS_INCLUDE1}")
	endif()
	message("project ${PROJECT_NAME}")
	if (websockets_shared)
		target_link_libraries(${PROJECT_NAME} websockets_shared ${LWS_DBUS_LIB} ${LIBWEBSOCKETS_DEP_LIBS})
		add_dependencies(${PROJECT_NAME} websockets_shared)
	else()
		target_link_libraries(${PROJECT_NAME} websockets ${LWS_DBUS_LIB} ${LIBWEBSOCKETS_DEP_LIBS})
	endif()
endif()
