-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
55 lines (39 loc) · 1.37 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
# @brief: Cmake file for ZJUNlict Crazy
# @author: Wang Yunkai
# @email: [email protected]
# @date: 2018.11.28
cmake_minimum_required (VERSION 3.0)
SET(PROJ_NAME "Crazy")
project (${PROJ_NAME})
# do not show the console window
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
endif()
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# find Qt5's components that this project need
find_package(Qt5 COMPONENTS QuickControls2)
# find qrc file which include qml files
qt5_add_resources(QML_QRC "Crazy.qrc")
set(RC_FILE Crazy.rc)
# some dirs
set(SRC "${CMAKE_CURRENT_LIST_DIR}/src")
set(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/bin")
# all head files
file(GLOB HEAD ${SRC}/interaction.h
${SRC}/radiopacket.h
)
# all source files
file(GLOB SOURCE ${SRC}/main.cpp
${SRC}/interaction.cpp
${SRC}/radiopacket.cpp
)
# include dirs
include_directories(${HEAD})
# need to add qrc file(which include the path of qml files) and rc file(which include the path of icon)
add_executable(${PROJ_NAME} ${SOURCE} ${QML_QRC} ${RC_FILE})
# link Qt5's components that this project need
target_link_libraries(${PROJ_NAME} Qt5::QuickControls2)
install(TARGETS ${PROJ_NAME} RUNTIME DESTINATION ${CMAKE_CURRENT_LIST_DIR}/bin)