-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
60 lines (50 loc) · 1.27 KB
/
CMakeLists.txt
File metadata and controls
60 lines (50 loc) · 1.27 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
cmake_minimum_required(VERSION 3.16)
project(formatusb VERSION 25.06.01 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find Qt6 first, fallback to Qt5
find_package(Qt6 COMPONENTS Core Widgets LinguistTools)
if (NOT Qt6_FOUND)
find_package(Qt5 5.15 COMPONENTS Core Widgets LinguistTools REQUIRED)
endif()
# Enable Qt automoc, autorcc, autouic
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Define the executable
add_executable(formatusb
main.cpp
mainwindow.cpp
about.cpp
cmd.cpp
mainwindow.ui
images.qrc
)
# Add headers (for IDE support)
target_sources(formatusb PRIVATE
mainwindow.h
version.h
about.h
cmd.h
)
# Link Qt libraries
target_link_libraries(formatusb
Qt::Core
Qt::Widgets
)
# Include directories
target_include_directories(formatusb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# Install target
install(TARGETS formatusb
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# Handle translations
file(GLOB TS_FILES translations/*.ts)
if(Qt6_FOUND)
qt_add_translations(formatusb TS_FILES ${TS_FILES})
else()
qt5_add_translation(QM_FILES ${TS_FILES})
target_sources(formatusb PRIVATE ${QM_FILES})
endif()