mirror of
https://gitee.com/apaki/cmake_demo.git
synced 2025-05-18 04:11:37 +08:00
41 lines
764 B
Plaintext
41 lines
764 B
Plaintext
|
||
# 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)
|