cmkelist 工程构建
cmake_minimum_required(VERSION 2.8)
project(webgo)
add_definitions(-std=c++11)
aux_source_directory(src DIR_SRCS)
aux_source_directory(src/roshandler DIR_SRCS2)
file(GLOB FILES_SRC
"src/*.h"
"src/*.cpp"
"src/roshandler/*.h"
"src/roshandler/*.cpp"
"include/*.h"
"include/*.hpp"
"include/uWebSockets/*.h"
"include/uWebSockets/*.cpp"
)
find_library(SSL_LIB
NAMES ssl
PATHS /usr/lib /usr/local/lib
)
message(STATUS "${SSL_LIB}")
find_library(CRYPTO_LIB
NAMES crypto
PATHS /usr/lib /usr/local/lib
)
message(STATUS "${CRYPTO_LIB}")
find_library(PTHREAD_LIB
NAMES pthread
PATHS /usr/lib /usr/local/lib
)
message(STATUS "${PTHREAD_LIB}")
find_library(BOOST_SYSTEM_LIB
NAMES boost_system
PATHS /usr/lib /usr/local/lib
)
message(STATUS "${BOOST_SYSTEM_LIB}")
find_library(ZLIB_LIB
NAMES z
PATHS /usr/lib /usr/local/lib
)
message(STATUS "${ZLIB_LIB}")
find_library(HIREDIS_LIB
NAMES hiredis
PATHS /usr/lib /usr/local/lib
)
message(STATUS "${HIREDIS_LIB}")
# 添加第三方的库
set(INC_DIR ${PROJECT_SOURCE_DIR}/include)
set(LINK_DIR ${PROJECT_SOURCE_DIR}/libs)
set(ROS_DIRS "/opt/ros/kinetic")
include_directories(
${INC_DIR}
${ROS_DIRS}/include
${PROJECT_SOURCE_DIR}/include
~/dashgo_ws/devel/include
)
message(STATUS "${ROS_DIRS}")
link_directories(
${LINK_DIR}
${ROS_DIRS}/lib
)
link_libraries(
uWS
${SSL_LIB}
${CRYPTO_LIB}
${PTHREAD_LIB}
${BOOST_SYSTEM_LIB}
${ZLIB_LIB}
rosconsole
roscpp
roscpp_serialization
rostime
boost_thread
${HIREDIS_LIB}
)
add_executable(${PROJECT_NAME} main.cpp ${DIR_SRCS} ${DIR_SRCS2})