1project(lws-minimal-gtk C) 2cmake_minimum_required(VERSION 2.8.12) 3find_package(libwebsockets CONFIG REQUIRED) 4list(APPEND CMAKE_MODULE_PATH ${LWS_CMAKE_DIR}) 5include(CheckCSourceCompiles) 6include(LwsCheckRequirements) 7 8set(SAMP lws-minimal-gtk) 9set(SRCS main.c) 10 11set(requirements 1) 12require_lws_config(LWS_ROLE_H1 1 requirements) 13require_lws_config(LWS_WITH_SERVER 1 requirements) 14require_lws_config(LWS_WITH_GLIB 1 requirements) 15require_lws_config(LWS_WITH_GTK 1 requirements) 16 17if (requirements) 18 19# gtk pieces 20 21 include (FindPkgConfig) 22 23 set(LWS_GTK_INCLUDE_DIRS CACHE PATH "Path to the gtk include directory") 24 set(LWS_GTK_LIBRARIES CACHE PATH "Path to the gtk library") 25 PKG_SEARCH_MODULE(LWS_GTK2 gtk+-3.0) 26 if (LWS_GTK2_FOUND) 27 list(APPEND LWS_GTK_INCLUDE_DIRS "${LWS_GTK2_INCLUDE_DIRS}") 28 list(APPEND LWS_GTK_LIBRARIES "${LWS_GTK2_LIBRARIES}") 29 endif() 30 message("gtk include dir: ${LWS_GTK_INCLUDE_DIRS}") 31 message("gtk libraries: ${LWS_GTK_LIBRARIES}") 32 include_directories("${LWS_GTK_INCLUDE_DIRS}") 33 set(extralibs ${extralibs} ${LWS_GTK_LIBRARIES}) 34 35 36 37 message("Extra libs: ${extralibs}") 38 39 add_executable(${SAMP} ${SRCS}) 40 41 if (websockets_shared) 42 target_link_libraries(${SAMP} websockets_shared ${extralibs} ${LIBWEBSOCKETS_DEP_LIBS}) 43 add_dependencies(${SAMP} websockets_shared) 44 else() 45 target_link_libraries(${SAMP} websockets ${extralibs} ${LIBWEBSOCKETS_DEP_LIBS}) 46 endif() 47endif() 48