forked from neundorf/CuteCom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
84 lines (66 loc) · 3.04 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
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR )
project(CuteCom)
set (CuteCom_MAJOR_VERSION 0)
set (CuteCom_MINOR_VERSION 50)
set (CuteCom_PATCH_VERSION 0)
set (CuteCom_VERSION
${CuteCom_MAJOR_VERSION}.${CuteCom_MINOR_VERSION}.${CuteCom_PATCH_VERSION})
configure_file (
"${PROJECT_SOURCE_DIR}/version.h.in"
"${PROJECT_SOURCE_DIR}/version.h"
)
# 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_AUTORCC ON)
# Find the Qt libraries
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5SerialPort REQUIRED)
find_package(Qt5Network REQUIRED)
qt5_wrap_ui(uiHeaders controlpanel.ui mainwindow.ui statusbar.ui sessionmanager.ui searchpanel.ui
macroplugin.ui macrosettings.ui netproxyplugin.ui netproxysettings.ui counterplugin.ui)
set(cutecomSrcs main.cpp mainwindow.cpp controlpanel.cpp devicecombo.cpp
serialdevicelistmodel.cpp settings.cpp statusbar.cpp sessionmanager.cpp
datadisplay.cpp datahighlighter.cpp searchpanel.cpp timeview.cpp ctrlcharacterspopup.cpp
plugin.cpp pluginmanager.cpp macroplugin.cpp macrosettings.cpp netproxyplugin.cpp netproxysettings.cpp
counterplugin.cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# C++14: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
#add_definitions("-std=c++11")
set(exeType)
set(binInstallDir bin )
if(APPLE)
set(exeType MACOSX_BUNDLE)
set(binInstallDir /Applications )
endif(APPLE)
add_executable(cutecom ${exeType} ${cutecomSrcs} ${uiHeaders} resources.qrc)
target_link_libraries(cutecom Qt5::Core Qt5::Gui Qt5::Widgets Qt5::SerialPort Qt5::Network)
if (APPLE)
set_target_properties(cutecom PROPERTIES OUTPUT_NAME CuteCom)
endif (APPLE)
install(TARGETS cutecom DESTINATION ${binInstallDir} )
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
endif()
set (CPACK_PACKAGE_VERSION ${CuteCom_VERSION})
set (CPACK_SOURCE_GENERATOR "TGZ")
set (CPACK_GENERATOR "RPM")
set (CPACK_PACKAGE_NAME "cutecom")
set (CPACK_PACKAGE_RELEASE 1)
set (CPACK_PACKAGE_VENDOR "cyc1insir")
set (CPACK_PACKAGE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/distribution/rpm-generic.spec.in"
"${CMAKE_CURRENT_BINARY_DIR}/cutecom.spec"
@ONLY IMMEDIATE )
set (CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/cutecom.spec")
set (CPACK_SOURCE_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set (CPACK_SOURCE_IGNORE_FILES
"${CMAKE_CURRENT_BINARY_DIR};/.git/;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)
add_custom_target(dist COMMAND git archive --format tar --prefix=cutecom-${CuteCom_VERSION}/ HEAD | gzip > ${CMAKE_CURRENT_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}.tgz WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})