-
Notifications
You must be signed in to change notification settings - Fork 37
/
CMakeLists.txt
54 lines (37 loc) · 1.24 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
# Reference: https://doc.qt.io/qt-6/cmake-manual.html
cmake_minimum_required(VERSION 3.16)
# Add folder where are supportive functions
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Include Qt basic functions
include(QtCommon)
# Basic information about project
project(example VERSION 1.0)
# Set PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK to 0 if not present, needed by add_project_meta
fix_project_version()
# Set additional project information
set(COMPANY "Example")
set(COPYRIGHT "Copyright (c) 2014 Vincent Lee. All rights reserved.")
set(IDENTIFIER "com.example.Example")
set(SOURCE_FILES
src/main.cpp
src/mainwindow.cpp
)
add_project_meta(META_FILES_TO_INCLUDE)
set(RESOURCE_FILES example.qrc)
find_package(Qt6 COMPONENTS Widgets REQUIRED)
qt_standard_project_setup()
add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
${SOURCE_FILES} ${META_FILES_TO_INCLUDE} ${RESOURCE_FILES}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)
target_precompile_headers(${PROJECT_NAME} INTERFACE QtWidgets.h)
target_link_libraries(${PROJECT_NAME} Qt6::Widgets)
install(
TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION /Applications
)