How to add includes? [closed]

asked 2017-08-11 09:25:07 -0500

Sergey Kravchenko gravatar image

updated 2017-08-11 09:25:44 -0500

I want to add some classes to my node. The classes are stored in separate files. So now I add header includes, for example

#include "HardwareSerial.h"

But the appropriate .cpp file cannot be viewed by compiler automatically. So I write the following in my CMakeLists.txt

add_library(hardwareserial src/HardwareSerial.cpp)
target_link_libraries(talker ${catkin_LIBRARIES} hardwareserial)

And it works.

But how can I add a whole directory to scan for .cpp files so that I could only include headers and appropriate .cpp files would be attached automatically without add_library instruction for each file?

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by tfoote
close date 2017-08-11 13:36:39.073725

Comments

This is a pure CMake question not a ROS question. Please reask on a more specifically scoped forum. I'd suggest considering: https://stackoverflow.com/questions/t...

tfoote gravatar image tfoote  ( 2017-08-11 13:36:29 -0500 )edit