# 指定头文件搜索目录 set(SYSTEM_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include) # 指定源文件路径 set(SYSTEM_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/source) set(${CMAKE_C_FLAGS} -lpthread) include_directories(${SYSTEM_INCLUDE_PATH}) include_directories(${MQTT_INCLUDE_PATH}) foreach(FOREACH_SRC_DIR ${SYSTEM_SOURCE_PATH}) aux_source_directory(${SYSTEM_SOURCE_PATH} SRC) endforeach() add_executable(${EXENAME} ${SRC}) target_link_libraries(${EXENAME} ${LIB_SYSTEM_MQTT}) target_link_libraries(${EXENAME} pthread-0.9.33.2)