35 lines
878 B
CMake
35 lines
878 B
CMake
# 最低CMake版本要求
|
||
cmake_minimum_required(VERSION 3.5.1)
|
||
|
||
# 项目名称
|
||
project(glog)
|
||
|
||
#添加debug信息,使得生成的可执行文件可以调试
|
||
#set(CMAKE_BUILD_TYPE DEBUG)
|
||
|
||
#使用通配符添加多个源文件
|
||
#file(GLOB SRC_LIST "src/*.c")
|
||
|
||
#编译选项
|
||
add_compile_options(-std=c++11)
|
||
|
||
# 头文件路径
|
||
include_directories("include")
|
||
|
||
#链接库
|
||
# link_libraries(event)
|
||
find_package(glog REQUIRED)
|
||
|
||
# 设置可执行文件的输出目录为 bin 目录
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
|
||
|
||
|
||
# 生成可执行的文件
|
||
# add_executable(bufferevent src/main.cpp src/Circle.cpp)
|
||
# 查找当前目录下的所有cpp文件,并将其存储到变量中
|
||
file(GLOB SOURCES "src/*.cpp")
|
||
|
||
# 将源文件添加到可执行文件中
|
||
add_executable(Circle ${SOURCES})
|
||
|
||
target_link_libraries(Circle glog) |