B
B
BelBES2018-02-04 16:50:02
Programming
BelBES, 2018-02-04 16:50:02

How to link in CMake with a dynamic library from a submodule?

Hello everyone, I have
the following problem. There is a project that is built by cmake, its structure is something like this:
add_subdirectory(foo_lib) // a dynamic library is built here
add_subdirectory(foo_app) // an application is built here that uses foo_lib
in foo_app, the library is linked like this:
target_link_libraries(foo_app ... foo_lib)
And here, if foo_lib is built into a static lib, then everything works correctly, but in the case when it is a dynamic library, when building foo_app, the linker falls with undefined reference for methods from foo_lib.
Has anyone come across something similar and perhaps know how to correctly handle the paths for dynamic libraries that are built within the same project?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question