| 1 |
project(lws-minimal-gtk C) |
| 2 |
cmake_minimum_required(VERSION 2.8.12) |
| 3 |
find_package(libwebsockets CONFIG REQUIRED) |
| 4 |
list(APPEND CMAKE_MODULE_PATH ${LWS_CMAKE_DIR}) |
| 5 |
include(CheckCSourceCompiles) |
| 6 |
include(LwsCheckRequirements) |
| 7 |
|
| 8 |
set(SAMP lws-minimal-gtk) |
| 9 |
set(SRCS main.c) |
| 10 |
|
| 11 |
set(requirements 1) |
| 12 |
require_lws_config(LWS_ROLE_H1 1 requirements) |
| 13 |
require_lws_config(LWS_WITH_SERVER 1 requirements) |
| 14 |
require_lws_config(LWS_WITH_GLIB 1 requirements) |
| 15 |
require_lws_config(LWS_WITH_GTK 1 requirements) |
| 16 |
|
| 17 |
if (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() |
| 47 |
endif() |