building a ROS1 node that depends on a shared precompiled library

asked 2021-07-12 18:08:44 -0500

ShehabAldeen gravatar image

Hello,

this may be an easy question for the CMake experts I guess.

So I am writing a cpp ROS1 node that depends on a certain Optimization library. I want my node to build just fine when I run the catkin_make command.

To build a cpp code (not part of a ROS node) that depends on that library I run the following commands

g++ -O -I$SNOPT/include -c sntoya.cpp -o sntoya.o

g++ -O sntoya.o  -o sntoya -L$SNOPT/lib -lsnopt7_cpp

How I can have those commands done while building a ROS node. I believe I have to write something in the CMakeLists.txt but I am not really sure where to start or what exactly to do.

I would appreciate some guidance and help.

Thank you :D

edit retag flag offensive close merge delete

Comments

this may be an easy question for the CMake experts I guess.

you already seem to recognise this is a CMake question. Technically we should close your question here, as it really is a CMake question, not a ROS one. Catkin (and even Ament) does not change anything here.

Limiting yourself to this ROS forum for answers is not necessary and is just going to take longer for you to get answers.

If you really want to keep it open here, please search the site (using Google: append site:answers.ros.org) for previous Q&As about this and mention them here in a comment. That way we can avoid suggesting things you've already seen and tried.

gvdhoorn gravatar image gvdhoorn  ( 2021-07-13 02:45:45 -0500 )edit

As a start: #q208850.

gvdhoorn gravatar image gvdhoorn  ( 2021-07-13 02:48:20 -0500 )edit