-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
134 lines (120 loc) · 3.43 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
project( qmisestruss LANGUAGES CXX )
cmake_minimum_required( VERSION 3.12.0 )
set( CMAKE_AUTOMOC ON )
set( CMAKE_INCLUDE_CURRENT_DIR ON )
set( CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH}"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules"
)
option( BUILD_TRANSLATIONS "Build project translations" ON )
option( USE_CPACK "Use cpack to create packages" OFF )
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR ( "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebugInfo"))
add_definitions(-DIS_DEBUG)
else()
add_compile_definitions(QT_NO_DEBUG)
endif()
if(MSVC)
add_compile_definitions(_USE_MATH_DEFINES)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}" )
include("${PROJECT_SOURCE_DIR}/version.cmake")
if(USE_CPACK)
include("${PROJECT_SOURCE_DIR}/use_cpack.cmake")
endif()
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/gui
${CMAKE_SOURCE_DIR}/core
)
set( misestruss_SRC
main.cpp
gui/mainwindow.cpp
core/misescalcnelast.cpp
core/misescalcelast.cpp
)
set( misestruss_HDR
gui/mainwindow.h
core/misescalcnelast.h
core/misescalcelast.h
defines.h
)
set( misestruss_UI
gui/mainwindow.ui
)
set( misestruss_QRC
mises1.qrc
)
if(WIN32)
set( misestruss_RC
Mises.rc
)
endif()
set( LANG_PATH langs )
set( misestruss_TRS
${LANG_PATH}/${PROJECT_NAME}_ru.ts
${LANG_PATH}/${PROJECT_NAME}_uk.ts
)
set(LICENSE_FILES
COPYING
)
IF( WIN32 )
set( QWT_ROOT "C:\\qwt-6.2.0-dev" CACHE STRING "Path to qwt library" )
ENDIF()
find_package( Qt5 COMPONENTS Widgets Svg REQUIRED )
find_package( LibQwt REQUIRED )
include_directories( ${Qt5Gui_INCLUDE_DIRS} )
qt5_add_resources( RSCS ${misestruss_QRC} )
if( BUILD_TRANSLATIONS )
find_package( Qt5LinguistTools REQUIRED )
set_source_files_properties(${misestruss_TRS} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${LANG_PATH}")
qt5_add_translation( TRS ${misestruss_TRS} )
endif()
qt5_wrap_ui( UIS ${misestruss_UI} )
set( QT_DEPLIBS
Qt5::Widgets
Qt5::Svg
)
add_definitions( ${QWT_DEFINITIONS} )
include_directories( ${QWT_INCLUDE_DIR} )
add_executable( ${PROJECT_NAME}
WIN32
${misestruss_SRC}
${UIS}
${RSCS}
${TRS}
${misestruss_RC}
)
target_link_libraries ( ${PROJECT_NAME}
${QT_DEPLIBS}
${QWT_LIBRARY}
)
if( UNIX AND NOT (APPLE OR CYGWIN) )
set( DATADIR_PATH ${CMAKE_INSTALL_PREFIX}/share )
set( APPDATA_PATH ${DATADIR_PATH}/applications )
set( ICON_FILES
icons/f\(x\)48.png
)
set( ICON_PATH
${DATADIR_PATH}/${PROJECT_NAME}/icons
)
set( DESKTOP_FILES
${PROJECT_NAME}.desktop
)
install( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
install( FILES ${ICON_FILES} DESTINATION ${ICON_PATH} )
install( FILES ${DESKTOP_FILES} DESTINATION ${APPDATA_PATH} )
if(BUILD_TRANSLATIONS)
install( FILES ${TRS} DESTINATION ${DATADIR_PATH}/${PROJECT_NAME}/${LANG_PATH} )
endif()
endif()
if( WIN32 )
set ( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE )
install( TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} )
if(BUILD_TRANSLATIONS)
install( FILES ${TRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/${LANG_PATH} )
endif()
install( FILES ${LICENSE_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()