Proper CMakeLists
It looks like I do not understand something in CMakelists. In my package, I have two C++ files, one called uart.cpp and another one called joint.cpp.
Joint uses uart functions and variables but only Join has rosnode and main function, so how do I make my CMakelists? I get that uart functions have undefined references and my CMakelists:
cmake_minimum_required(VERSION 2.8.3)
project(genius_control)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
serial
)
catkin_package(
INCLUDE_DIRS
include
CATKIN_DEPENDS
roscpp
LIBRARIES
genius_control
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE)
add_library(genius_control
include/${PROJECT_NAME}/uart.h
include/${PROJECT_NAME}/joint.h
src/uart.cpp
src/joint.cpp
)
add_executable(joint src/joint.cpp)
target_link_libraries(genius_control ${catkin_LIBRARIES})
Please note: this is not a Catkin or ROS related question. It's purely CMake.