File: CMakeLists.txt

package info (click to toggle)
cutemaze 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 1,832 kB
  • sloc: cpp: 2,747; sh: 173; xml: 125; makefile: 11
file content (85 lines) | stat: -rw-r--r-- 2,365 bytes parent folder | download
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
cmake_minimum_required(VERSION 3.16.0)

# Configure project
project(cutemaze VERSION 1.3.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt6 REQUIRED COMPONENTS Core Gui LinguistTools Svg Widgets)
if(UNIX AND NOT APPLE)
	include(GNUInstallDirs)
endif()

add_compile_definitions(
	QT_STRICT_ITERATORS
	QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
	QT_DISABLE_DEPRECATED_BEFORE=0x060000
)

# Create translations
file(GLOB translations_SRCS translations/*.ts)
qt6_add_translation(translations_QM ${translations_SRCS})

add_custom_target(update_translations
	COMMAND Qt6::lupdate -no-obsolete -locations none src -ts ${translations_SRCS}
	WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
	VERBATIM
)

# Create program
qt6_add_executable(cutemaze
	src/board.cpp
	src/cell.cpp
	src/locale_dialog.cpp
	src/main.cpp
	src/maze.cpp
	src/new_game_dialog.cpp
	src/path.cpp
	src/scores_dialog.cpp
	src/settings.cpp
	src/solver.cpp
	src/theme.cpp
	src/window.cpp
	icons/icons.qrc
	themes/theme.qrc
	preview/preview.qrc
	${translations_QM}
)

target_link_libraries(cutemaze PRIVATE
	Qt6::Core
	Qt6::Gui
	Qt6::Svg
	Qt6::Widgets
)

target_compile_definitions(cutemaze PRIVATE VERSIONSTR="${PROJECT_VERSION}")

# Install
if(UNIX AND NOT APPLE)
	target_sources(cutemaze PRIVATE icons/icon.qrc)

	install(TARGETS cutemaze RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
	install(FILES ${translations_QM} DESTINATION ${CMAKE_INSTALL_DATADIR}/cutemaze/translations)
	install(FILES doc/cutemaze.6 DESTINATION ${CMAKE_INSTALL_MANDIR}/man6 COMPONENT doc)
	install(DIRECTORY icons/hicolor DESTINATION ${CMAKE_INSTALL_DATADIR}/icons)
	install(FILES icons/cutemaze.appdata.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
	install(FILES icons/cutemaze.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
elseif(WIN32)
	# Use Qt6 macro until CMake provides something
	# https://bugreports.qt.io/browse/QTBUG-87618
	set_target_properties(cutemaze PROPERTIES
		WIN32_EXECUTABLE TRUE
		QT_TARGET_VERSION "${PROJECT_VERSION}"
		QT_TARGET_COMPANY_NAME "Graeme Gott"
		QT_TARGET_DESCRIPTION "Simple maze game"
		QT_TARGET_COPYRIGHT "Copyright (C) 2021 Graeme Gott"
		QT_TARGET_PRODUCT_NAME "CuteMaze"
		QT_TARGET_RC_ICONS ${CMAKE_SOURCE_DIR}/icons/cutemaze.ico
	)
	_qt_internal_generate_win32_rc_file(cutemaze)
endif()