-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (44 loc) · 1.91 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
# ----------------------------------------------------------------------------
# Root CMake file for cppManagement
# ----------------------------------------------------------------------------
# 设置CMake的最低版本要求
cmake_minimum_required(VERSION 3.10)
# 定义项目名称
project(cppManagement)
# ----------------------------------------------------------------------------
# 定义可执行文件
# ----------------------------------------------------------------------------
add_executable(${PROJECT_NAME})
# ----------------------------------------------------------------------------
# 搜集源代码文件
# ----------------------------------------------------------------------------
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SRCS)
target_sources(${PROJECT_NAME}
PRIVATE
${SRCS}
)
message("===================================")
string(REPLACE ";" "\n" SRCS_WITH_NEWLINES "${SRCS}")
message("source:")
message(${SRCS_WITH_NEWLINES})
message("===================================\n")
# ----------------------------------------------------------------------------
# 设置项目头文件目录
# ----------------------------------------------------------------------------
target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
# ----------------------------------------------------------------------------
# 链接所需的库
# ----------------------------------------------------------------------------
find_package(Boost REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE boost::boost)
find_package(OpenCV REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${OpenCV_LIBS})
# ----------------------------------------------------------------------------
# 安装
# ----------------------------------------------------------------------------
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${PROJECT_NAME} # 设置可执行文件的安装目录
)