0

I am using ROS and I have an external library consisting of a static library foo.a and a path with header. Now my CmakeLists.txt looks like this:

...
include_directories(/home/foo/include/)
find_library(LIB_TO_Include foo /home/foo/lib/static) //here is the foo.a

cs_add_library(${PROJECT_NAME} src/bar.cc)
catkin_add_gtest(test_bar test/test_bar.cc
             WORKING_DIRECTORY ${CMAKE_BINARY_DIR}})
target_link_libraries(test_bar ${LIBRARY_NAME} ${LIB_TO_Include})
...

So the tests work. But when I include this package into another package I get the following errors:

bar.o undefined referenes to functions of foo

So my package does not have any executable to which I could link my external library so how would I integrate it than? How can I correctly link that external library?

Emilio7773
  • 187
  • 1
  • 9

1 Answers1

0

One of the object modules (files) in your library has an external reference and uses a function or object from another library. When building an application with your library, you need to specify an additional external library that is referenced. There may be more than one such external third-party library.

You can find out how to add external libraries to a сmake project here CMake link to external library

awoland
  • 86
  • 1
  • 7