加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
cmake_minimum_required(VERSION 2.8)
project(mqtt-client)
set(TARGETS "mqtt-client")
set(SUBDIRS "common" "mqtt" "platform" "network" "mqttclient")
# 库文件前缀
set(LIBRARY_PREFIX "mc")
# 设置版本信息
set(PROJECT_MAJOR_VERSION 1) # 架版本信息
set(PROJECT_MINOR_VERSION 2) # 主版本信息
set(PROJECT_PATCH_VERSION 0) # 次版本信息
set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION})
set(PROJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_ROOT_DIR}/build/bin) #设置可执行文件的输出目录
set(LIBRARY_OUTPUT_PATH ${PROJECT_ROOT_DIR}/build/lib) #设置库文件的输出目录
link_directories(${LIBRARY_OUTPUT_PATH})
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_C_FLAGS "-lpthread")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -O0 -g -no-pie -ggdb")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3 -DNDEBUG")
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_CXX_FLAGS "-lpthread")
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g -no-pie -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
endif(CMAKE_COMPILER_IS_GNUCXX)
#########################################
## load cmake config and load 3rdparty ##
#########################################
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/color.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/module.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)
# foreach(incdir ${INCDIRS})
# include_directories(${incdir})
# endforeach()
include_directories(${PROJECT_ROOT_DIR}/config)
foreach(subdir ${SUBDIRS})
add_subdirectory(${PROJECT_ROOT_DIR}/${subdir})
endforeach()
get_module_info()
show_module_info()
install_project()
if(BUILD_EXAMPLES)
add_subdirectory(example)
endif()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化