-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (52 loc) · 2.21 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
#-------------------------------------------------------------------------------
# CMAKE SETTINGS
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.21.1)
set(QT_MINIMUM_VERSION 6.2.2)
#-------------------------------------------------------------------------------
# SOURCE CODE
#-------------------------------------------------------------------------------
file(GLOB_RECURSE HEADER_FILES "src/*.h")
file(GLOB_RECURSE SOURCE_FILES "src/*.cpp")
#-------------------------------------------------------------------------------
# PROJECT SETTINGS
#-------------------------------------------------------------------------------
set(TARGET_NAME qt-ui-template)
set(PROJECT_NAME ${TARGET_NAME})
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(${PROJECT_NAME} LANGUAGES CXX)
#-------------------------------------------------------------------------------
# Qt SETTINGS
#-------------------------------------------------------------------------------
# Required Qt settings
set(QtPath "C:\\Qt\\6.2.2\\mingw_64")
set(CMAKE_PREFIX_PATH ${QtPath})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# Find the necessary Qt5 modules
find_package(Qt6Core REQUIRED)
find_package(Qt6Gui REQUIRED)
find_package(Qt6Widgets REQUIRED)
#-------------------------------------------------------------------------------
# SOURCE GROUPS
#-------------------------------------------------------------------------------
source_group(generated REGULAR_EXPRESSION ".*_automoc.cpp")
source_group(sources REGULAR_EXPRESSION ".*[.]cpp")
source_group(headers REGULAR_EXPRESSION ".*[.]h")
#-------------------------------------------------------------------------------
# ADDITIONAL LIBRARIES
#-------------------------------------------------------------------------------
list(APPEND LIBRARIES
Qt6::Core
Qt6::Gui
Qt6::Widgets
)
#-------------------------------------------------------------------------------
# GENERATE EXECUTABLE
#-------------------------------------------------------------------------------
# Generate the executable
add_executable(${TARGET_NAME} ${HEADER_FILES} ${SOURCE_FILES})
# link libraries
target_link_libraries(${TARGET_NAME} ${LIBRARIES})