-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
39 lines (30 loc) · 901 Bytes
/
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
cmake_minimum_required(VERSION 3.18)
# Project name and setting C++ version
project(qt6_test LANGUAGES CXX)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find the required Qt6 components
find_package(Qt6 REQUIRED COMPONENTS Widgets)
# Add UI files, headers, and sources
set(CMAKE_AUTOMOC ON) # Enable automatic MOC (Meta Object Compiler) for Qt
set(CMAKE_AUTORCC ON) # Enable automatic RCC (Resource Compiler) if you have Qt resource files
set(CMAKE_AUTOUIC ON) # Enable automatic UIC for .ui files
# Add the sources and UI files
set(SOURCES
main.cpp
mainwindow.cpp
dialog.cpp
)
set(HEADERS
mainwindow.h
dialog.h
)
set(UIS
mainwindow.ui
dialog.ui
)
# Create the executable
add_executable(${PROJECT_NAME} ${SOURCES} ${UIS} ${HEADERS})
# Link the Qt6 Widgets module
target_link_libraries(${PROJECT_NAME} Qt6::Widgets)