summaryrefslogtreecommitdiffstats
path: root/client/SDL/dialogs/CMakeLists.txt
blob: 4cf2a16822b185a635d961069031dfb48ad40888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
set(SRCS
    sdl_button.hpp
    sdl_button.cpp
    sdl_buttons.hpp
    sdl_buttons.cpp
    sdl_dialogs.cpp
    sdl_dialogs.hpp
    sdl_widget.hpp
    sdl_widget.cpp
    sdl_input.hpp
    sdl_input.cpp
    sdl_input_widgets.cpp
    sdl_input_widgets.hpp
    sdl_select.hpp
    sdl_select.cpp
    sdl_selectlist.hpp
    sdl_selectlist.cpp
    sdl_connection_dialog.cpp
    sdl_connection_dialog.hpp
)

list(APPEND LIBS
    sdl_client_res
    winpr
)

if (NOT WITH_SDL_LINK_SHARED)
    list(APPEND LIBS ${SDL2_STATIC_LIBRARIES})
else()
    list(APPEND LIBS ${SDL2_LIBRARIES})
endif()

macro(find_sdl_component name)
	find_package(${name})
	if (NOT ${name}_FOUND)
		find_package(PkgConfig REQUIRED)
		pkg_check_modules(${name} REQUIRED ${name})

		if (BUILD_SHARED_LIBS)
			list(APPEND LIBS ${${name}_LIBRARIES})
			link_directories(${${name}_LIBRARY_DIRS})
			include_directories(${${name}_INCLUDE_DIRS})
		else()
			list(APPEND LIBS ${${name}_STATIC_LIBRARIES})
			link_directories(${${name}_STATIC_LIBRARY_DIRS})
			include_directories(${${name}_STATIC_INCLUDE_DIRS})
		endif()
	else()
		if (WITH_SDL_LINK_SHARED)
			list(APPEND LIBS ${name}::${name})
		else()
			list(APPEND LIBS ${name}::${name}-static)
		endif()
	endif()
endmacro()

find_sdl_component(SDL2_ttf)

option(WITH_SDL_IMAGE_DIALOGS "Build with SDL_image support (recommended)" OFF)
if (WITH_SDL_IMAGE_DIALOGS)
    find_sdl_component(SDL2_image)
    add_definitions(-DWITH_SDL_IMAGE_DIALOGS)
endif()

add_subdirectory(res)

add_library(dialogs STATIC
    ${SRCS}
)

target_link_libraries(dialogs PRIVATE ${LIBS})

if(BUILD_TESTING)
#	add_subdirectory(test)
endif()