cmake_minimum_requir ed VERSION 11 project G9 find_package Qt5Core REQ

 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
cmake_minimum_required(VERSION 2.8.11)
project(G9)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Multimedia REQUIRED)
find_package(Qt5X11Extras REQUIRED)
ADD_DEFINITIONS(${QT_DEFINITIONS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror -g")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(HEADER_FILES
const.h
init.h
screenshoter.h
popupwindow.h
settingswindow.h
qtransparentlabel.h
qxt/qxtglobalshortcut.h
qxt/qxtglobalshortcut_p.h)
set(SRC_LIST
main.cpp
init.cpp
screenshoter.cpp
popupwindow.cpp
settingswindow.cpp
qtransparentlabel.cpp
qxt/qxtglobalshortcut.cpp)
IF (WIN32)
set(OS_SRC qxt/qxtglobalshortcut_win.cpp)
ELSE()
set(OS_SRC qxt/qxtglobalshortcut_x11.cpp)
ENDIF()
set(RESOURCES resources.qrc)
QT5_ADD_RESOURCES(RESOURCES_RCC ${RESOURCES})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(LIB_LIST
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Multimedia
Qt5::Network
Qt5::X11Extras
X11
)
add_executable(${PROJECT_NAME} ${SRC_LIST} ${OS_SRC} ${RESOURCES_RCC})
target_link_libraries(${PROJECT_NAME} ${LIB_LIST})
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove_directory bin/res
COMMAND ${CMAKE_COMMAND} -E copy_directory res bin/res
)
include_directories(
/usr/include/qt5/QtGui/5.2.1/QtGui
)