How to add sqlite3 dependency to catkin package?
I am writing a ROS node that uses the sqlite3 c library. I have been including it with:
#include <sqlite3.h>
I have the header in /usr/include, but when I build with catkin I get linker errors to all of the sqlite functions. I think that I need to add the library as a depency somehow with CMake, but I'm not sure how. How can I add sqlite3 as a dependency?
Something to consider: how would you do this with plain CMake?
I don't know, I am new to CMake. Do you know?
Reason I posted this comment is that I wanted to make you realise your question is not ROS-specific. There is nothing that Catkin adds or modifies here. With that, this opens up the pool of resources you have at your disposal to include the entire global CMake community (ie: the internet).
Asking this sort of question here on ROS Answers is of course completely OK. However, it also means you have to wait for answers, which can take a long time (sometimes). And there is no need to wait. Just use google and search for how to link to sqlite3 using CMake.
We're here to help, but with this kind of question it's best to turn to a venue that is suited for the type of question. As this is a pure CMake question, ROS Answers is not that venue.
I do believe there are ROS specific aspects of this question (correct me if I am wrong). For example I need to make catkin aware that I am dependent on this system library so that if another package (package A) depends on my package, catkin will automatically figure out that package A also depends on the system library. I think I need something like this here: http://docs.ros.org/melodic/api/catki...
That would be a separate issue (namely: dependency management).
You mention:
That's an issue with your build script, not with how dependencies in your package manifest are stated.
And technically, that would still be independent of Catkin: the package manifest is not tied to Catkin. It's build tool agnostic (it's also used in ROS 2 for instance, which doesn't do anything with Catkin).
Please understand I'm being pedantic for a reason here: you are new to "all" of this, so it's important to immediately understand what is "part of ROS" and what is not. CMake is not. As I wrote earlier, realising this should make it easier to find resources you could ask for help, as the CMake user community is larger than the ROS one.
Thanks for the help! I'll keep that in mind.