-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
108 lines (91 loc) · 2.92 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
#
# Collett – CMake Build File
# ==========================
#
# This file is a part of Collett
# Copyright 2020–2024, Veronica Berglyd Olsen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.14)
# Version
file(READ "src/collett.h" COLLET_H)
string(REGEX MATCH "#define[ ]+COL_VERSION_STR[ ]+\"([0-9a-z\.\-]+)\"" _ ${COLLET_H})
set(Collett_RELEASE ${CMAKE_MATCH_1})
string(REGEX MATCH "([0-9\.]*)" _ ${Collett_RELEASE})
set(Collett_VERSION ${CMAKE_MATCH_1})
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build.")
message(STATUS "Collett Version: ${Collett_VERSION}")
message(STATUS "Collett Release: ${Collett_RELEASE}")
project(Collett LANGUAGES CXX VERSION ${Collett_VERSION})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 ${CMAKE_CXX_FLAGS_DEBUG}")
# Qt6 Library
# ===========
# Note: Qt6 include folder must be available. The following assumes lib/qt6 is
# either a local copy or a symlink to it.
# set(CMAKE_PREFIX_PATH "lib/qt6/6.5.0/gcc_64/lib/cmake/")
cmake_policy(SET CMP0115 OLD)
set(QT_DEFAULT_MAJOR_VERSION 6)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Svg LinguistTools)
if(Qt6Core_FOUND)
message(STATUS "Found Qt6Core Version: ${Qt6Core_VERSION}")
endif()
if(Qt6Widgets_FOUND)
message(STATUS "Found Qt6Widgets Version: ${Qt6Widgets_VERSION}")
endif()
# i18n
# ====
set(TS_FILES
i18n/collett_en_US.ts
i18n/collett_nb_NO.ts
)
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
# Sources
# =======
# Source Folders
include_directories(
src/editor
src/core
src/gui
src
)
# Source Files
list(APPEND SRC_FILES
src/core/data
src/core/icons
src/core/project
src/core/settings
src/core/storage
src/core/svgiconengine
src/editor/textedit
src/gui/maintoolbar
src/guimain
src/main
)
# Targets
# =======
qt_add_executable(Collett ${SRC_FILES} ${TS_FILES})
qt_add_resources(Collett "assets" FILES
assets/styles.qss
)
set_target_properties(Collett PROPERTIES OUTPUT_NAME "collett")
target_link_libraries(Collett PRIVATE Qt::Widgets Qt::Svg)
target_compile_definitions(Collett PUBLIC "$<$<CONFIG:DEBUG>:DEBUG>")