cmake_minimum_required(VERSION 3.0.2)
project(pkgname)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++14)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
)

find_package(PCL REQUIRED)
FIND_PACKAGE(Protobuf REQUIRED)

set(vtk_flags)
foreach(it ${dir_defs})
 if(it MATCHES "vtk*")
  list(APPEND vtk_flags ${it})
 endif()
endforeach()

foreach(d ${vtk_flags})
 remove_definitions(-D${d})
endforeach()

catkin_package(
	
#  INCLUDE_DIRS include
#  LIBRARIES pkgname
#  CATKIN_DEPENDS roscpp std_msgs
#  DEPENDS system_lib
)

aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/communication COMMUNICATION_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/message MESSAGE_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/tool TOOL_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/error_code ERROR_SRC )
include_directories(
# include
  ${catkin_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
  ${PROTOBUF_INCLUDE_DIRS}
  ./src/communication
  ./src/message
  ./src/tool
  ./src/error_code
)

add_executable(${PROJECT_NAME}_node ./src/main.cpp
        ${TOOL_SRC}
        ${COMMUNICATION_SRC}
        ${MESSAGE_SRC}
        ${ERROR_SRC}
        )

 target_link_libraries(${PROJECT_NAME}_node
         /usr/local/lib/libglog.a
         /usr/local/lib/libgflags.a
   ${catkin_LIBRARIES}
   ${PCL_LIBRARIES}
   ${PROTOBUF_LIBRARIES}
   nnxx
   nanomsg
 )

