-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
99 lines (80 loc) · 2.79 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
cmake_minimum_required(VERSION 3.25)
project(MudletBootstrap VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(QT_STATIC ON)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
# Explicitly find static libb2
find_library(LIBB2_STATIC libb2.a REQUIRED)
find_library(LIB_BROTLIDEC libbrotlidec.a REQUIRED)
find_library(LIB_BROTLICOMMON libbrotlicommon.a REQUIRED)
find_library(LIB_ZLIB libz.a REQUIRED)
find_library(LIB_ZSTD libzstd.a REQUIRED)
# Enable static runtime linking (GCC/MinGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -Wl,--gc-sections")
endif()
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Widgets LinguistTools Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets LinguistTools Network)
set(TS_FILES MudletBootstrap_en_US.ts)
set(PROJECT_SOURCES
main.cpp
MudletBootstrap.h
MudletBootstrap.cpp
${TS_FILES}
)
qt_add_executable(MudletBootstrap
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
target_link_libraries(MudletBootstrap PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Network
)
if(WIN32)
target_link_libraries(MudletBootstrap PRIVATE
${LIBB2_STATIC}
${LIB_BROTLIDEC}
${LIB_BROTLICOMMON}
${LIB_ZLIB}
${LIB_ZSTD}
)
endif()
qt_add_resources(RESOURCES resources.qrc)
target_sources(MudletBootstrap PRIVATE ${RESOURCES})
message(STATUS
"Project Version: ${PROJECT_VERSION}\n"
"Project Version Major: ${PROJECT_VERSION_MAJOR}\n"
"Project Version Minor: ${PROJECT_VERSION_MINOR}"
)
set_target_properties(MudletBootstrap PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_ICON_FILE mudlet.icns
MACOSX_BUNDLE_BUNDLE_NAME MudletBootstrap
MACOSX_BUNDLE_GUI_IDENTIFIER org.mudlet.bootstrap
WIN32_EXECUTABLE TRUE
)
if(APPLE)
file(GLOB ICON_FILE "mudlet.icns")
message(STATUS "Using icon file: ${ICON_FILE}")
target_sources(MudletBootstrap PRIVATE ${ICON_FILE})
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif()
include(GNUInstallDirs)
install(TARGETS MudletBootstrap
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(MudletBootstrap)
endif()