cmake_demo/CMakelists.txt
2023-12-25 11:44:17 +08:00

41 lines
764 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 0. cmake 最低版本号要求
cmake_minimum_required(VERSION 3.8)
# 0. 项目信息
project(demo)
# 2. 添加当前路径
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# 2. 配置项目
option(USE_DEMO "use demo application interface" ON)
# 2. 配置文件
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
# 2. 配置条件
if(USE_DEMO)
# include_directories(.)
# else()
# pass
endif(USE_DEMO)
# 0. 查找当前目录下的所有文件并将名称保存在DIR_SRC中
aux_source_directory(. DIR_SRC)
# 1. 添加子目录
add_subdirectory(src)
# 1. 添加头文件路径
include_directories(src)
# 0. 指定生成目标
add_executable(demo ${DIR_SRC})
# 1. 添加链接库
target_link_libraries(demo list)