-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (74 loc) · 2.76 KB
/
CMakeLists.txt
File metadata and controls
90 lines (74 loc) · 2.76 KB
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
cmake_minimum_required(VERSION 3.16)
project(Help_Viewer VERSION 1.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 REQUIRED COMPONENTS
Core
LinguistTools
Widgets
)
qt_standard_project_setup()
# Make sure the mandatory command line variables are set
if (NOT DEFINED HELP_VIEWER_PROGRAM_NAME)
message(FATAL_ERROR "The 'HELP_VIEWER_PROGRAM_NAME' variable must be defined with the program displayed name (use quotes around the name if it contains the space character).")
endif()
if (NOT DEFINED HELP_VIEWER_CONTENT_RESOURCE_FILE)
message(FATAL_ERROR "The 'HELP_VIEWER_CONTENT_RESOURCE_FILE' variable must be defined with the path to the Qt resource file containing the help documents to display.")
endif()
add_compile_definitions(HELP_VIEWER_PROGRAM_NAME="${HELP_VIEWER_PROGRAM_NAME}")
# Allow to use global paths in local application includes
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
set(PROJECT_SOURCES
Main.cpp
MainWindow.cpp
MainWindow.hpp
MainWindow.ui
RemoteControl.cpp
RemoteControl.hpp
)
# Embed the Windows executable icon
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND PROJECT_SOURCES "Icon/Icon.rc")
# Embed the macOS executable icon
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist generated by CMake, it contains the .icns file name without the path
set(MACOSX_BUNDLE_ICON_FILE Icon.icns)
# Tell CMake where to find and install the icon file
set(HELP_VIEWER_ICON_MACOS "${CMAKE_CURRENT_SOURCE_DIR}/Icon/Icon.icns")
set_source_files_properties(${HELP_VIEWER_ICON_MACOS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
list(APPEND PROJECT_SOURCES "Icon/Icon.icns")
endif()
# Resources must be specified before the executable, so the resulting source file can be embedded in the executable
set(PROJECT_RESOURCES "")
qt_add_resources(PROJECT_RESOURCES
${HELP_VIEWER_CONTENT_RESOURCE_FILE}
Resources.qrc
)
qt_add_executable(Help_Viewer
${PROJECT_SOURCES}
${PROJECT_RESOURCES}
)
qt_add_translations(Help_Viewer
TS_FILES
Translations/de.ts
Translations/es.ts
Translations/fr.ts
Translations/it.ts
RESOURCE_PREFIX "/Translations"
LUPDATE_OPTIONS "-no-obsolete"
)
set_target_properties(Help_Viewer PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "Help Viewer"
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
target_link_libraries(Help_Viewer
PRIVATE Qt6::Widgets
)
include(GNUInstallDirs)
install(TARGETS Help_Viewer
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)