-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (43 loc) · 1.27 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
#cmake最低版本
cmake_minimum_required(VERSION 3.21.1)
# 这里指定当前模块名以及开发版本,这里推荐用文件名作为模块名
project(ADream VERSION 0.1.0)
set(CMAKE_PREFIX_PATH "D:/Qt/6.5.0/mingw_64/" "D:/VulkanSDK/1.3.243.0")
# 添加Qt的模块
find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)
#指定输出路径
SET(OUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
if (NOT EXISTS ${OUT_PATH})
file(MAKE_DIRECTORY ${OUT_PATH})
endif ()
SET(EXECUTABLE_OUTPUT_PATH ${OUT_PATH})
SET(LIBRARY_OUTPUT_PATH ${OUT_PATH})
# 指定 自定模块目录
set(QML_IMPORT_PATH ${OUT_PATH})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# 添加子目录
add_subdirectory(Controls)
add_subdirectory(Moudles)
qt_add_resources(RESOURCES resources.qrc)
set(SOURCES
main.cpp
resources.qrc
)
# 添加当前项目
add_executable(ADream ${SOURCES} ${RESOURCES})
# 将自定义控件的动态库链接到当前项目
target_link_libraries(ADream Controls)
target_link_libraries(ADream Moudles)
# 设置Qt的相关属性
set_target_properties(ADream PROPERTIES
AUTOMOC ON
AUTORCC ON
AUTOUIC ON
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
QT_AUTOMOC ON
QT_AUTORCC ON
QT_AUTOGEN ON
)
# 将Qt的模块链接到当前项目
target_link_libraries(ADream Qt6::Core Qt6::Gui Qt6::Widgets)