blob: c120736bed8d8cedea456251c4a6807c017c45de (
plain) (
blame)
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
|
################################################################################
# General
################################################################################
PROJECT(printergui)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
# set compiler optimizations for debug and release
IF (CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE Debug)
ENDIF()
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Wunused -Wunreachable-code -pedantic -fno-strict-aliasing")
SET(CMAKE_C_FLAGS_RELEASE "-O2 -fno-strict-aliasing")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -Wunused -Wunreachable-code -pedantic -fno-strict-aliasing")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -fno-strict-aliasing" )
# local cmake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# this command finds libraries and sets all required variables
FIND_PACKAGE(Qt4 REQUIRED)
FIND_PACKAGE(Cups REQUIRED)
# include Qt modules
#SET(QT_USE_QTDBUS TRUE)
SET(QT_USE_QTNETWORK TRUE)
#SET(QT_USE_QTWEBKIT TRUE)
# some includes
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
)
################################################################################
# Variables
################################################################################
# printergui (maingui)
FILE(GLOB MAINGUI_SRCS
src/maingui/*.cpp
src/*.c
)
# password gui (printpwgui
FILE(GLOB PWGUI_SRCS
src/pwgui/*.cpp
src/*.c
)
################################################################################
# Qt
################################################################################
# .ui files
FILE(GLOB MAINGUI_UIS
src/maingui/*.ui
)
# includes all header files that should be treated with moc
SET(MAINGUI_MOC_HDRS
src/maingui/printergui.h
src/maingui/backdrop.h
src/maingui/pwgui.h
)
# add some useful macros and variables
# (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains
# a path to CMake script)
INCLUDE(${QT_USE_FILE})
# this will run uic on .ui files
QT4_WRAP_UI(MAINGUI_UI_HDRS ${MAINGUI_UIS})
# this will run moc
QT4_WRAP_CPP(MAINGUI_MOC_SRCS ${MAINGUI_MOC_HDRS})
################################################################################
# Build
################################################################################
ADD_EXECUTABLE(printergui
${MAINGUI_SRCS}
${MAINGUI_MOC_SRCS}
${MAINGUI_UI_HDRS}
${MAINGUI_RC_SRCS}
)
ADD_EXECUTABLE(printpwgui
${PWGUI_SRCS}
)
# link
TARGET_LINK_LIBRARIES(printergui
${QT_LIBRARIES}
${CUPS_LIBRARIES}
)
# install
INSTALL(TARGETS printergui printpwgui RUNTIME DESTINATION bin)
|