source: trunk/CMakeLists.txt @ 14533

Last change on this file since 14533 was 14533, checked in by mikedld, 6 years ago

#5851: Use per-thread locale setup if possible

This prevents crashes on concurrent tr_variantFromBuf, tr_variantToBuf
and tr_variantGetReal use.

File size: 16.3 KB
Line 
1cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
2project(transmission)
3
4list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
5
6include(CheckIncludeFile)
7include(CheckIncludeFiles)
8include(CheckFunctionExists)
9include(CheckLibraryExists)
10include(ExternalProject)
11include(GNUInstallDirs)
12include(TrMacros)
13
14        option(ENABLE_DAEMON        "Build daemon" ON)
15tr_auto_option(ENABLE_GTK           "Build GTK+ client" AUTO)
16tr_auto_option(ENABLE_QT            "Build Qt client" AUTO)
17        option(ENABLE_UTILS         "Build utils (create, edit, show)" ON)
18        option(ENABLE_CLI           "Build command-line client" OFF)
19        option(ENABLE_TESTS         "Build unit tests" ON)
20        option(ENABLE_LIGHTWEIGHT   "Optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc." OFF)
21        option(ENABLE_UTP           "Build µTP support" ON)
22        option(ENABLE_NLS           "Enable native language support" ON)
23        option(INSTALL_DOC          "Build/install documentation" ON)
24        option(INSTALL_LIB          "Install the library" OFF)
25        option(USE_QT5              "Use Qt 5 (instead of default Qt 4)" OFF)
26tr_auto_option(USE_SYSTEM_EVENT2    "Use system event2 library" AUTO)
27tr_auto_option(USE_SYSTEM_DHT       "Use system dht library" AUTO)
28tr_auto_option(USE_SYSTEM_MINIUPNPC "Use system miniupnpc library" AUTO)
29tr_auto_option(USE_SYSTEM_NATPMP    "Use system natpmp library" AUTO)
30tr_auto_option(USE_SYSTEM_UTP       "Use system utp library" AUTO)
31tr_auto_option(USE_SYSTEM_B64       "Use system b64 library" AUTO)
32tr_list_option(WITH_CRYPTO          "Use specified crypto library" AUTO openssl cyassl polarssl)
33tr_auto_option(WITH_INOTIFY         "Enable inotify support (on systems that support it)" AUTO)
34tr_auto_option(WITH_KQUEUE          "Enable kqueue support (on systems that support it)" AUTO)
35tr_auto_option(WITH_SYSTEMD         "Add support for systemd startup notification (on systems that support it)" AUTO)
36
37set(TR_NAME ${PROJECT_NAME})
38
39# convention: -TR MAJOR MINOR MAINT STATUS - (each a single char)
40# STATUS: "X" for prerelease beta builds,
41#         "Z" for unsupported trunk builds,
42#         "0" for stable, supported releases
43# these should be the only two lines you need to change
44set(TR_USER_AGENT_PREFIX "2.84+")
45set(TR_PEER_ID_PREFIX "-TR284Z-")
46
47string(REGEX MATCH "^([0-9]+)\\.([0-9]+).*" TR_VERSION "${TR_USER_AGENT_PREFIX}")
48set(TR_VERSION_MAJOR "${CMAKE_MATCH_1}")
49set(TR_VERSION_MINOR "${CMAKE_MATCH_2}")
50
51if(TR_PEER_ID_PREFIX MATCHES "X-$")
52    set(TR_BETA_RELEASE 1)
53elseif(TR_PEER_ID_PREFIX MATCHES "Z-$")
54    set(TR_NIGHTLY_RELEASE 1)
55else()
56    set(TR_STABLE_RELEASE 1)
57endif()
58
59set(TR_SCM_REVISION_FILE "${CMAKE_SOURCE_DIR}/REVISION")
60set(TR_SCM_REVISION_RELIABLE ON)
61
62if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.svn)
63    find_package(Subversion)
64    if(Subversion_FOUND)
65        Subversion_WC_INFO(${CMAKE_SOURCE_DIR} TR_SVN)
66        set(TR_SCM_REVISION "${TR_SVN_WC_REVISION}")
67    endif()
68elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
69    find_package(Git)
70    if(GIT_FOUND)
71        execute_process(
72            COMMAND
73                ${GIT_EXECUTABLE} rev-list --max-count=1 --abbrev-commit HEAD
74            WORKING_DIRECTORY
75                ${CMAKE_SOURCE_DIR}
76            OUTPUT_VARIABLE
77                TR_SCM_REVISION
78            OUTPUT_STRIP_TRAILING_WHITESPACE
79        )
80    endif()
81endif()
82
83if("${TR_SCM_REVISION}" STREQUAL "" AND EXISTS "${TR_SCM_REVISION_FILE}")
84    file(READ "${TR_SCM_REVISION_FILE}" TR_SCM_REVISION)
85    string(STRIP "${TR_SCM_REVISION}" TR_SCM_REVISION)
86endif()
87
88if("${TR_SCM_REVISION}" STREQUAL "")
89    # Give up and check the source files
90    set(TR_SCM_REVISION 0)
91    set(TR_SCM_REVISION_RELIABLE OFF)
92    file(GLOB_RECURSE TR_ALL_SOURCES RELATIVE ${CMAKE_SOURCE_DIR} *.cc *.[chm] *.po)
93    foreach(F ${TR_ALL_SOURCES})
94        file(STRINGS ${F} F_ID REGEX "\\$Id:")
95        if(F_ID MATCHES "\\$Id: [^ ]+ ([0-9]+) " AND CMAKE_MATCH_1 GREATER TR_SCM_REVISION)
96            set(TR_SCM_REVISION ${CMAKE_MATCH_1})
97        endif()
98    endforeach()
99endif()
100
101if("${TR_SCM_REVISION}" STREQUAL "")
102    set(TR_SCM_REVISION 0)
103else()
104    if(TR_SCM_REVISION_RELIABLE)
105        file(WRITE "${TR_SCM_REVISION_FILE}" "${TR_SCM_REVISION}")
106    else()
107        file(REMOVE "${TR_SCM_REVISION_FILE}")
108    endif()
109endif()
110
111set_property(GLOBAL PROPERTY USE_FOLDERS ON)
112
113set(CURL_MINIMUM            7.15.4)
114set(EVENT2_MINIMUM          2.0.10)
115set(OPENSSL_MINIMUM         0.9.4)
116set(CYASSL_MINIMUM          3.0)
117set(POLARSSL_MINIMUM        1.2)
118set(ZLIB_MINIMUM            1.2.3)
119set(GTK_MINIMUM             3.4.0)
120set(GLIB_MINIMUM            2.32.0)
121set(GIO_MINIMUM             2.26.0)
122set(LIBAPPINDICATOR_MINIMUM 0.4.90)
123
124tr_github_upstream(EVENT2    libevent/libevent  c51b159cff 7be95856a39714dfd2218cb56415c990)
125tr_github_upstream(NATPMP    miniupnp/libnatpmp cf7f452d66 f1e7d5bf580972738d8ef21743d0adf7)
126tr_github_upstream(MINIUPNPC miniupnp/miniupnp  5de2bcb561 bdc5b64b9b8401d3524c50b9ec8173c1)
127tr_github_upstream(DHT       jech/dht           bf62643a95 0a2a2abe447d8a73f0084c1bc837e566)
128tr_github_upstream(UTP       bittorrent/libutp  7c4f19abdf 8b92aa05abec5f6675cdde6477cd6f51)
129tr_github_upstream(B64       mikedld/libb64     c1e3323498 10128cb30ad768d2c4caf627e0f69db3)
130
131if(WIN32)
132    foreach(L C CXX)
133        # Target version (Vista and up)
134        set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DWINVER=0x0600 -D_WIN32_WINNT=0x0600")
135        # Use Unicode API (although we always use W or A names explicitly)
136        set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DUNICODE -D_UNICODE")
137        # Ignore various deprecation and security warnings (at least for now)
138        set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS")
139        # Increase maximum FD_SET size
140        set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DFD_SETSIZE=1024")
141        if(MSVC)
142            # Reduce noise (at least for now)
143            set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} /wd4244 /wd4267")
144        endif()
145    endforeach()
146endif()
147
148find_package(Threads)
149find_package(PkgConfig QUIET)
150
151find_package(CURL ${CURL_MINIMUM} REQUIRED)
152
153if(UNIX)
154    find_package(ICONV REQUIRED)
155endif()
156
157if(WITH_CRYPTO STREQUAL "AUTO" OR WITH_CRYPTO STREQUAL "openssl")
158    tr_get_required_flag(WITH_CRYPTO OPENSSL_IS_REQUIRED)
159    find_package(OpenSSL ${OPENSSL_MINIMUM} ${OPENSSL_IS_REQUIRED})
160    tr_fixup_list_option(WITH_CRYPTO "openssl" OPENSSL_FOUND "AUTO" OPENSSL_IS_REQUIRED)
161    if(WITH_CRYPTO STREQUAL "openssl")
162        set(CRYPTO_PKG "openssl")
163        set(CRYPTO_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
164        set(CRYPTO_LIBRARIES ${OPENSSL_LIBRARIES})
165    endif()
166endif()
167if(WITH_CRYPTO STREQUAL "AUTO" OR WITH_CRYPTO STREQUAL "cyassl")
168    tr_get_required_flag(WITH_CRYPTO CYASSL_IS_REQUIRED)
169    find_package(CyaSSL ${CYASSL_MINIMUM} ${CYASSL_IS_REQUIRED})
170    tr_fixup_list_option(WITH_CRYPTO "cyassl" CYASSL_FOUND "AUTO" CYASSL_IS_REQUIRED)
171    if(WITH_CRYPTO STREQUAL "cyassl")
172        set(CRYPTO_PKG "cyassl")
173        set(CRYPTO_INCLUDE_DIRS ${CYASSL_INCLUDE_DIRS})
174        set(CRYPTO_LIBRARIES ${CYASSL_LIBRARIES})
175    endif()
176endif()
177if(WITH_CRYPTO STREQUAL "AUTO" OR WITH_CRYPTO STREQUAL "polarssl")
178    tr_get_required_flag(WITH_CRYPTO POLARSSL_IS_REQUIRED)
179    find_package(PolarSSL ${POLARSSL_MINIMUM} ${POLARSSL_IS_REQUIRED})
180    tr_fixup_list_option(WITH_CRYPTO "polarssl" POLARSSL_FOUND "AUTO" POLARSSL_IS_REQUIRED)
181    if(WITH_CRYPTO STREQUAL "polarssl")
182        set(CRYPTO_PKG "polarssl")
183        set(CRYPTO_INCLUDE_DIRS ${POLARSSL_INCLUDE_DIRS})
184        set(CRYPTO_LIBRARIES ${POLARSSL_LIBRARIES})
185    endif()
186endif()
187# We should have found the library by now
188if(CRYPTO_PKG STREQUAL "")
189    if(WITH_CRYPTO STREQUAL "AUTO")
190        message(FATAL_ERROR "Unable to find any supported crypto library.")
191    else()
192        message(FATAL_ERROR "Requested crypto library '${WITH_CRYPTO}' is not supported.")
193    endif()
194endif()
195
196if(ENABLE_GTK)
197    tr_get_required_flag(ENABLE_GTK GTK_IS_REQUIRED)
198
199    pkg_check_modules(GTK ${GTK_IS_REQUIRED}
200        gtk+-3.0>=${GTK_MINIMUM}
201        glib-2.0>=${GLIB_MINIMUM}
202        gio-2.0>=${GIO_MINIMUM}
203        gmodule-2.0>=${GLIB_MINIMUM}
204        gthread-2.0>=${GLIB_MINIMUM})
205
206    tr_fixup_auto_option(ENABLE_GTK GTK_FOUND GTK_IS_REQUIRED)
207
208    set(WITH_LIBAPPINDICATOR OFF)
209    if(ENABLE_GTK)
210        pkg_check_modules(LIBAPPINDICATOR appindicator3-0.1>=${LIBAPPINDICATOR_MINIMUM})
211        if(LIBAPPINDICATOR_FOUND)
212            set(WITH_LIBAPPINDICATOR ON)
213        endif()
214    endif()
215endif()
216
217if(ENABLE_QT)
218    tr_get_required_flag(ENABLE_QT QT_IS_REQUIRED)
219
220    if(POLICY CMP0020)
221        cmake_policy(SET CMP0020 NEW)
222    endif()
223
224    if(USE_QT5)
225        set(TR_QT5_MODULES Core Gui Widgets Network DBus LinguistTools)
226        set(QT_FOUND ON)
227        foreach(M ${TR_QT5_MODULES})
228            find_package(Qt5${M} ${QT_IS_REQUIRED})
229            if(NOT Qt5${M}_FOUND)
230                set(QT_FOUND OFF)
231                break()
232            endif()
233        endforeach()
234    else()
235        find_package(Qt4 4.6.2 ${QT_IS_REQUIRED} COMPONENTS QtCore QtGui QtNetwork QtDBus)
236    endif()
237
238    tr_fixup_auto_option(ENABLE_QT QT_FOUND QT_IS_REQUIRED)
239endif()
240
241find_package(ZLIB ${ZLIB_MINIMUM})
242if(ZLIB_FOUND)
243    add_definitions(-DHAVE_ZLIB)
244endif()
245
246set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third-party)
247
248if(WIN32)
249    tr_add_external_auto_library(EVENT2 event
250        PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${THIRD_PARTY_DIR}/event2.cmake" "<SOURCE_DIR>/CMakeLists.txt")
251else()
252    tr_add_external_auto_library(EVENT2 event
253        BUILD_IN_SOURCE 1
254        CONFIGURE_COMMAND "<SOURCE_DIR>/autogen.sh"
255                  COMMAND "<SOURCE_DIR>/configure" "--prefix=<INSTALL_DIR>" "--disable-shared")
256endif()
257
258tr_add_external_auto_library(NATPMP natpmp
259    PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${THIRD_PARTY_DIR}/natpmp.cmake" "<SOURCE_DIR>/CMakeLists.txt")
260if(NOT USE_SYSTEM_NATPMP)
261    set(NATPMP_DEFINITIONS -DNATPMP_STATICLIB)
262endif()
263
264tr_add_external_auto_library(MINIUPNPC miniupnpc
265    PATCH_COMMAND "${CMAKE_COMMAND}" -E remove_directory "<SOURCE_DIR>/minissdpd"
266          COMMAND "${CMAKE_COMMAND}" -E remove_directory "<SOURCE_DIR>/miniupnpc-async"
267          COMMAND "${CMAKE_COMMAND}" -E remove_directory "<SOURCE_DIR>/miniupnpc-libevent"
268          COMMAND "${CMAKE_COMMAND}" -E remove_directory "<SOURCE_DIR>/miniupnpd"
269          COMMAND "${CMAKE_COMMAND}" -E remove "<SOURCE_DIR>/README"
270          COMMAND "${CMAKE_COMMAND}" -E copy_directory "<SOURCE_DIR>/miniupnpc" "<SOURCE_DIR>"
271          COMMAND "${CMAKE_COMMAND}" -E remove_directory "<SOURCE_DIR>/miniupnpc"
272    CMAKE_ARGS
273        -DUPNPC_BUILD_STATIC=ON
274        -DUPNPC_BUILD_SHARED=OFF
275        -DUPNPC_BUILD_TESTS=OFF)
276set(MINIUPNPC_DEFINITIONS -DSYSTEM_MINIUPNP)
277if(NOT USE_SYSTEM_MINIUPNPC)
278    list(APPEND MINIUPNPC_DEFINITIONS -DMINIUPNP_STATICLIB)
279    set(MINIUPNPC_VERSION 1.9)
280    set(MINIUPNPC_API_VERSION 12)
281endif()
282
283tr_add_external_auto_library(DHT dht
284    PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${THIRD_PARTY_DIR}/dht.cmake" "<SOURCE_DIR>/CMakeLists.txt")
285
286if(ENABLE_UTP)
287    tr_add_external_auto_library(UTP utp
288        PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${THIRD_PARTY_DIR}/utp.cmake" "<SOURCE_DIR>/CMakeLists.txt"
289              COMMAND "${CMAKE_COMMAND}" -E copy "${THIRD_PARTY_DIR}/utp_config.h" "<SOURCE_DIR>/utp_config.h"
290              COMMAND "${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>" patch -p1 --binary -i "${THIRD_PARTY_DIR}/utp-01-ticket-5002.patch")
291endif()
292
293tr_add_external_auto_library(B64 b64
294    PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${THIRD_PARTY_DIR}/b64.cmake" "<SOURCE_DIR>/CMakeLists.txt"
295          COMMAND "${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>" patch -p1 -i "${THIRD_PARTY_DIR}/b64-01-newline.patch"
296          COMMAND "${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>" patch -p1 -i "${THIRD_PARTY_DIR}/b64-02-unsigned-char.patch")
297
298if(WITH_INOTIFY)
299    tr_get_required_flag(WITH_INOTIFY INOTIFY_IS_REQUIRED)
300
301    set(INOTIFY_FOUND OFF)
302    check_include_file(sys/inotify.h HAVE_SYS_INOTIFY_H)
303    check_function_exists(inotify_init HAVE_INOTIFY_INIT)
304    if(HAVE_SYS_INOTIFY_H AND HAVE_INOTIFY_INIT)
305        set(INOTIFY_FOUND ON)
306    endif()
307
308    tr_fixup_auto_option(WITH_INOTIFY INOTIFY_FOUND INOTIFY_IS_REQUIRED)
309endif()
310
311if(WITH_KQUEUE)
312    tr_get_required_flag(WITH_KQUEUE KQUEUE_IS_REQUIRED)
313
314    set(KQUEUE_FOUND OFF)
315    check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
316    check_function_exists(kqueue HAVE_KQUEUE)
317    if(HAVE_SYS_EVENT_H AND HAVE_KQUEUE)
318        set(KQUEUE_FOUND ON)
319    endif()
320
321    tr_fixup_auto_option(WITH_KQUEUE KQUEUE_FOUND KQUEUE_IS_REQUIRED)
322endif()
323
324if(WITH_SYSTEMD)
325    tr_get_required_flag(WITH_SYSTEMD SYSTEMD_IS_REQUIRED)
326
327    pkg_check_modules(SYSTEMD_DAEMON ${SYSTEMD_IS_REQUIRED} libsystemd-daemon)
328
329    tr_fixup_auto_option(WITH_SYSTEMD SYSTEMD_DAEMON_FOUND SYSTEMD_IS_REQUIRED)
330endif()
331
332include_directories(${CMAKE_BINARY_DIR})
333
334if(WIN32)
335    foreach(L C CXX)
336        # Filter out needless definitions
337        set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DWIN32_LEAN_AND_MEAN -DNOMINMAX")
338    endforeach()
339endif()
340
341if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
342    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
343    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
344
345    set(NEEDED_COMPILER_FLAGS
346        -Wall
347        -W
348        -Wcast-align
349        -Wfloat-equal
350        -Wformat-security
351        -Wmissing-format-attribute
352        -Wpointer-arith
353        -Wredundant-decls
354        -Wundef
355        -Wunused-parameter
356        -Wwrite-strings)
357
358    if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_VERSION VERSION_GREATER "3.3")
359        list(APPEND NEEDED_COMPILER_FLAGS
360            -Wextra
361            -Winit-self)
362    endif()
363
364    set(NEEDED_C_COMPILER_FLAGS
365        ${NEEDED_COMPILER_FLAGS}
366        -Winline
367        -Wmissing-declarations
368        -Wnested-externs
369        -Wstrict-prototypes)
370    string(REPLACE ";" " " NEEDED_C_COMPILER_FLAGS_STRING "${NEEDED_C_COMPILER_FLAGS}")
371    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NEEDED_C_COMPILER_FLAGS_STRING}")
372
373    set(NEEDED_CXX_COMPILER_FLAGS
374        ${NEEDED_COMPILER_FLAGS})
375    string(REPLACE ";" " " NEEDED_CXX_COMPILER_FLAGS_STRING "${NEEDED_CXX_COMPILER_FLAGS}")
376    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NEEDED_CXX_COMPILER_FLAGS_STRING}")
377endif()
378
379include(LargeFileSupport)
380
381set(NEEDED_HEADERS
382    stdbool.h
383    sys/statvfs.h
384    xfs/xfs.h
385    xlocale.h)
386
387if(ENABLE_NLS)
388    list(APPEND NEEDED_HEADERS libintl.h)
389endif()
390
391foreach(H ${NEEDED_HEADERS})
392    tr_make_id("${H}" H_ID)
393    check_include_file(${H} HAVE_${H_ID})
394    if(HAVE_${H_ID})
395        add_definitions(-DHAVE_${H_ID})
396    endif()
397endforeach()
398
399set(NEEDED_FUNCTIONS
400    canonicalize_file_name
401    daemon
402    fallocate64
403    getmntent
404    getpagesize
405    htonll
406    iconv_open
407    localtime_r
408    memmem
409    mkdtemp
410    ntohll
411    posix_fadvise
412    posix_fallocate
413    posix_memalign
414    pread
415    pwrite
416    statvfs
417    strlcpy
418    strsep
419    syslog
420    uselocale
421    valloc)
422
423foreach(F ${NEEDED_FUNCTIONS})
424    tr_make_id("${F}" F_ID)
425    check_function_exists(${F} HAVE_${F_ID})
426    if(HAVE_${F_ID})
427        add_definitions(-DHAVE_${F_ID})
428    endif()
429endforeach()
430
431# if(MINGW)
432#     check_function_exists(__mingw_printf HAVE_MINGW_PRINTF)
433#     if(HAVE_MINGW_PRINTF)
434#         add_definitions(-D__USE_MINGW_ANSI_STDIO=1 -D__STDC_FORMAT_MACROS=1)
435#     endif()
436# endif()
437
438if(ENABLE_NLS)
439    check_library_exists(intl libintl_gettext "" HAVE_LIBINTL)
440    if(HAVE_LIBINTL)
441        set(LIBINTL_LIBRARY intl)
442    endif()
443endif()
444
445check_library_exists(m sqrt "" HAVE_LIBM)
446if(HAVE_LIBM)
447    set(LIBM_LIBRARY m)
448endif()
449
450if(ENABLE_TESTS)
451    enable_testing()
452    include(CTest)
453endif()
454
455add_subdirectory(libtransmission)
456
457foreach(P daemon cli utils gtk qt)
458    string(TOUPPER "${P}" P_ID)
459    if(ENABLE_${P_ID})
460        add_subdirectory(${P})
461    endif()
462endforeach()
463
464if(ENABLE_DAEMON OR ENABLE_GTK OR ENABLE_QT)
465    install(DIRECTORY web DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${TR_NAME}
466        PATTERN *.am EXCLUDE
467        PATTERN *.scss EXCLUDE)
468endif()
469
470if(ENABLE_GTK AND ENABLE_NLS)
471    find_package(Gettext REQUIRED)
472    add_subdirectory(po)
473endif()
474
475if(INSTALL_DOC)
476    install(FILES AUTHORS COPYING NEWS README extras/rpc-spec.txt extras/send-email-when-torrent-done.sh DESTINATION ${CMAKE_INSTALL_DOCDIR})
477endif()
478
479set(CPACK_SOURCE_GENERATOR TBZ2)
480set(CPACK_SOURCE_PACKAGE_FILE_NAME "${TR_NAME}-${TR_USER_AGENT_PREFIX}")
481set(CPACK_SOURCE_IGNORE_FILES
482    \\\\.svn
483)
484
485include(CPack)
Note: See TracBrowser for help on using the repository browser.