forked from gtorrent/gtorrent-gtk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
76 lines (57 loc) · 2.65 KB
/
CMakeLists.txt
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
#############################################################
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
ENDIF (COMMAND cmake_policy)
PROJECT (gtorrent-gtk)
SET (GTORRENT_VERSION_MAJOR 0)
SET (GTORRENT_VERSION_MINOR 0)
SET (GTORRENT_VERSION_PATCH 2)
#############################################################
# Configure version into utils/Version.hpp
SET (VERSION ${GTORRENT_VERSION_MAJOR}.${GTORRENT_VERSION_MINOR}.${GTORRENT_VERSION_PATCH})
CONFIGURE_FILE (src/utils/Version.hpp.in Version.hpp @ONLY)
# Set Cmake to build runtime in cwd
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
# Options
OPTION (WIN_DEBUG "Disable -mwindows for debugging purposes" OFF)
OPTION (ENABLE_TESTEXCUTABLE "Enable the compilation of a simple test" OFF)
OPTION (USE_LOGGING "Turns logging on/off" ON)
OPTION (Boost_USE_STATIC_LIBS "Use static version of Boost libraries." ON)
OPTION (Boost_USE_MULTITHREADED "Use multithreaded version of Boost." ON)
OPTION (Boost_USE_STATIC_RUNTIME "Use Boost static runtime." OFF)
IF (USE_LOGGING)
ADD_DEFINITIONS(-DUSE_LOGGING=1)
ENDIF()
# adds Windows flag necessary to prevent console window spawning and allows override to disable this for debugging purposes
IF (WIN32 AND (NOT WIN_DEBUG))
SET (WIN32_CXXFLAGS "-mwindows" ) #Prevents process from automatically spawning a console window for Windows release builds.
ELSE ()
SET (WIN32_CXXFLAGS "") #Initializes WIN32_CXXFLAGS as blank for other platforms and for Windows debug builds.
ENDIF ()
# Set compiler flags
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall ${WIN32_CXXFLAGS}")
# Fuck libboost for not providing boost.pc or fucking something
SET (Boost_USE_STATIC_LIBS ON)
SET (Boost_USE_MULTITHREADED ON)
SET (Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
# Find libraries the proper way
INCLUDE (FindPkgConfig)
PKG_SEARCH_MODULE (LIBTORRENT REQUIRED libtorrent-rasterbar)
PKG_SEARCH_MODULE (LIBGTKMM REQUIRED gtkmm-3.0)
PKG_SEARCH_MODULE (LIBGLIBMM REQUIRED glibmm-2.4)
PKG_SEARCH_MODULE (LIBNOTIFY REQUIRED libnotify)
# Build gt-core
ADD_SUBDIRECTORY (gtorrent-core/src)
# Build gt-gtk
ADD_SUBDIRECTORY (src)
# Uninstall target
CONFIGURE_FILE (
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
file(COPY assets/gtorrent.png DESTINATION ${CMAKE_BINARY_DIR})
file(COPY assets/settings.glade DESTINATION ${CMAKE_BINARY_DIR})
ADD_CUSTOM_TARGET (uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)