gradle
https://services.gradle.org/distributions/
C:\Users*.gradle\wrapper\dists\gradle-2.10-all
#BOOST
#./bootstrap.sh --prefix=/opt/boost/
#./b2 install
cmake_minimum_required(VERSION 2.8)
project(mqtt_dispatcher)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wno-unused-variable")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-O0 -g0")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_C_FLAGS_RELEASE "-O0 -g0")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
set(BOOST_ROOT "/opt/boost")
#set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
#set(Boost_USE_STATIC_RUNTIME OFF)
#
#BOOST组件依赖
find_package(Boost REQUIRED COMPONENTS
# regex
filesystem
system
thread
)
if(NOT Boost_FOUND)
message("未发现Boost")
endif()
include_directories(${Boost_INCLUDE_DIRS}
# /opt/boost/lib
)
FIND_LIBRARY(LIB_MQTT NAMES mosquitto PATHS /usr/lib/ /usr/local/lib/)
FIND_LIBRARY(LIB_BOOST NAMES mosquitto PATHS /opt/ )
find_package(Threads REQUIRED)
if(THREADS_HAVE_PTHREAD_ARG)
target_compile_options(PUBLIC my_app "-pthread")
endif()
file(GLOB srcfiles "*.cpp")
file(GLOB headerfiles "*.h")
AUX_SOURCE_DIRECTORY(. DIR_SRCS)
ADD_EXECUTABLE(mqtt_dispatcher ${DIR_SRCS})
INCLUDE_DIRECTORIES(/opt/boost/include/)
TARGET_LINK_LIBRARIES(mqtt_dispatcher ${LIB_MQTT} ${LIB_BOOST} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})