-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
98 lines (81 loc) · 2.99 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Project name and version
project(Presenter_Server)
set(VERSION_MAJOR 2)
set(VERSION_MINOR 0)
set(VERSION_BETA 0)
# Supported presenter protocol version
set(PRESENTER_PROTOCOL_MIN_VERSION 1)
set(PRESENTER_PROTOCOL_MAX_VERSION 2)
# The subdirectories to build
set(SUBDIRS main test)
# Minimum cmake version
cmake_minimum_required(VERSION 3.5.1)
# Enable testing
enable_testing()
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# Find the QtWidgets library
find_package(Qt5Widgets REQUIRED)
# Set compiler flags on g++
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
# Here the -D_DEBUG is needed because it's not set under cmake in ubuntu
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -ggdb -Wall -Wextra -O0 -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG="-fprofile-arcs -ftest-coverage")
endif(CMAKE_COMPILER_IS_GNUCXX)
# Set some Win Specific Settings
if(WIN32)
set(GUI_TYPE WIN32) # Disables console
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP")
include_directories("C:/Program Files (x86)/Visual Leak Detector/include")
if (CMAKE_CL_64)
link_directories("C:/Program Files (x86)/Visual Leak Detector/lib/Win64")
else(CMAKE_CL_64)
link_directories("C:/Program Files (x86)/Visual Leak Detector/lib/Win32")
endif(CMAKE_CL_64)
endif(MSVC)
else(WIN32)
set(GUI_TYPE )
set(RSRC )
endif(WIN32)
if(CMAKE_CXX_FLAGS_RELEASE)
add_definitions(-DUSED_CXXFLAGS="${CMAKE_CXX_FLAGS_RELEASE}")
endif(CMAKE_CXX_FLAGS_RELEASE)
if(CMAKE_CXX_FLAGS_DEBUG)
add_definitions(-DUSED_CXXFLAGS_DEBUG="${CMAKE_CXX_FLAGS_DEBUG}")
endif(CMAKE_CXX_FLAGS_DEBUG)
# Enable code coverage on linux
if(UNIX)
add_custom_target (coverage
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/main/res/scripts/coverage.sh
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif(UNIX)
# Set some Apple MacOS Specific settings
if(APPLE)
set(GUI_TYPE MACOSX_BUNDLE)
endif(APPLE)
# Linux specific settings. We need a key sender daemon running as priviledged
# user to inject events
if(UNIX)
# The network port to use for linux daemon.
# Stay above 1024 to allow usage without root if the user configured
# the access to the input device without root rights.
set(KEYSENDER_PORT 1111)
# Generate the port config header
configure_file("daemon_port.h.in" "${PROJECT_BINARY_DIR}/daemon_port.h")
# Build the daemon
set(SUBDIRS ${SUBDIRS} keysenderDaemon)
endif(UNIX)
# Build subdirs and include for build
foreach(SUB ${SUBDIRS})
include_directories(${SUB})
link_directories(${PROJECT_BINARY_DIR}/${SUB})
add_subdirectory(${SUB})
endforeach(SUB)