File: CMakeLists.txt

package info (click to toggle)
psi-plugins 1.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,368 kB
  • sloc: cpp: 42,063; xml: 714; ansic: 84; makefile: 61; sh: 12
file content (135 lines) | stat: -rw-r--r-- 3,024 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
unset(_HDRS)
unset(_UIS)
unset(_SRCS)
unset(_RSCS)
unset(PLUGIN)

set( PLUGIN otrplugin )
project(${PLUGIN})
cmake_minimum_required(VERSION 3.1.0)
set( CMAKE_AUTOMOC TRUE )

IF( NOT WIN32 )
	set( LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
	set( PLUGINS_PATH "lib${LIB_SUFFIX}/psi-plus/plugins" CACHE STRING "Install suffix for plugins" )
ELSE()
	set( PLUGINS_PATH "psi-plus/plugins" CACHE STRING "Install suffix for plugins" )
ENDIF()

IF( ${PROJECT_SOURCE_DIR} )
	set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/modules" )
ELSE()
	set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/modules")
ENDIF()

IF( WIN32 )
	if(NOT LIBGCRYPT_ROOT)
		set( LIBGCRYPT_ROOT "C:\\build\\psibuild\\psideps\\libgcrypt\\i386" CACHE STRING "Path to libgcrypt library" )
	endif()
	if(NOT LIBGPGERROR_ROOT)
		set( LIBGPGERROR_ROOT "C:\\build\\psibuild\\psideps\\libgpg-error\\i386" CACHE STRING "Path to libgpg-error library" )
	endif()
	if(NOT LIBOTR_ROOT)
		set( LIBOTR_ROOT "C:\\build\\psibuild\\psideps\\libotr\\i386" CACHE STRING "Path to libotr library" )
	endif()
	if(NOT LIBGCRYPT_ROOT)
		set( LIBTIDY_ROOT "C:\\build\\psibuild\\psideps\\libtidy\\i386" CACHE STRING "Path to libtidy library" )
	endif()
	add_definitions( -DQ_WS_WIN )
ENDIF()
find_package( LibGcrypt REQUIRED )
find_package( LibOtr REQUIRED )
find_package( LibTidy REQUIRED )
find_package( LibGpgError REQUIRED )
add_definitions(
		-DQT_PLUGIN
		-DHAVE_QT5
		${LIBOTR_DEFINITIONS}
		${LIBTIDY_DEFINITIONS}
		${LIBGCRYPT_DEFINITIONS}
		${LIBGPGERROR_DEFINITIONS}
)
#dirty hack for windows
IF( WIN32 )
	set(TIDY_INCLUDES
		${LIBTIDY_INCLUDE_DIR}/..
	)
ENDIF()
#
include_directories(
		${CMAKE_SOURCE_DIR}
		${CMAKE_CURRENT_BINARY_DIR}
		${LIBOTR_INCLUDE_DIR}
		${LIBTIDY_INCLUDE_DIR}
		${LIBGCRYPT_INCLUDE_DIR}
		${LIBGPGERROR_INCLUDE_DIR}
		${TIDY_INCLUDES}
		../../include
		./src
		.
)
set( _HDRS
	src/psiotrplugin.h
	src/otrmessaging.h
	src/otrinternal.h
	src/psiotrconfig.h
	src/psiotrclosure.h
	src/htmltidy.h
	src/otrlextensions.h
)
set( _SRCS
	src/psiotrplugin.cpp
	src/otrmessaging.cpp
	src/otrinternal.cpp
	src/psiotrconfig.cpp
	src/psiotrclosure.cpp
	src/htmltidy.cpp
	src/otrlextensions.c
)
set( _RSCS
	${PLUGIN}.qrc
)

find_package( Qt5 COMPONENTS Widgets Xml Concurrent REQUIRED )
set(QT_DEPLIBS
	Qt5::Widgets
	Qt5::Xml
	Qt5::Concurrent
)
qt5_add_resources(RSCS ${_RSCS})

add_library(
	${PLUGIN}
	MODULE
	${_SRCS}
	${UIS}
	${RSCS}
)
target_link_libraries(
	${PLUGIN}
	${QT_DEPLIBS}
	${LIBOTR_LIBRARY}
	${LIBTIDY_LIBRARY}
	${LIBGCRYPT_LIBRARY}
	${LIBGPGERROR_LIBRARY}
)
if( UNIX AND NOT( APPLE OR CYGWIN ) )
	install(
		TARGETS
		${PLUGIN}
		LIBRARY
		DESTINATION
		${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
		RUNTIME DESTINATION
		${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
	)
endif()
if( WIN32 )
	install(
		TARGETS
		${PLUGIN}
		LIBRARY
		DESTINATION ${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
		RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
	)
endif()