How to add includes? [closed]

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

Sergey Kravchenko gravatar image

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

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 for more details. by tfoote
close date 2017-08-11 13:36:39.073725


This is a pure CMake question not a ROS question. Please reask on a more specifically scoped forum. I'd suggest considering:

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