-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
49 lines (41 loc) · 1.1 KB
/
CMakeLists.txt
File metadata and controls
49 lines (41 loc) · 1.1 KB
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
cmake_minimum_required(VERSION 3.10)
# 设置项目名称
project(PluginManager)
# 设置 C 标准
set(CMAKE_C_STANDARD 11)
# 查找 Lua 库
find_package(Lua REQUIRED)
# 查找 libzip 库
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBZIP REQUIRED libzip)
# 查找 inih 库
# 如果是手动下载的 inih,可直接包含头文件和源文件路径
# 如果是通过包管理器安装的,使用 pkg_check_modules 查找
option(USE_SYSTEM_INIH "Use system installed inih library" ON)
if(USE_SYSTEM_INIH)
pkg_check_modules(INI REQUIRED inih)
else()
# 手动指定 inih 头文件和源文件路径
set(INI_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/path/to/inih")
set(INI_SOURCES "${CMAKE_SOURCE_DIR}/path/to/inih/ini.c")
endif()
# 包含头文件目录
include_directories(
include
${LUA_INCLUDE_DIR}
${LIBZIP_INCLUDE_DIRS}
${INI_INCLUDE_DIRS}
)
# 添加可执行文件
add_executable(plugin_manager
src/main.c
src/plugin_manager.c
${INI_SOURCES}
)
# 链接库
target_link_libraries(plugin_manager
${LUA_LIBRARIES}
${LIBZIP_LIBRARIES}
${INI_LIBRARIES}
pthread
)