Re: Adding own Library to project

Li, Jun R

Hi Patrick,

If you still want to keep your library (module), another way you can do is to add your library as the link dependency for the application library (app) by the following:

target_link_libraries(app your_lib_name)


On 6/13/18, 06:37, "devel@... on behalf of Patrick Boettcher" <devel@... on behalf of patrick.boettcher@...> wrote:

Hi Patrick,

On Wed, 13 Jun 2018 10:54:57 +0200
König Patrick <Patrick.Koenig@...> wrote:

> Hello,
> My name is Patrick König. I am new to zephyr. I just wrote a couple
> of functions as additions to the zephyr/samples/subsys/usb/cdc_acm
> Sample Project for the Nordic nRf52840. These are working fine and
> have been tested.
> Now I moved these functions from the main.c file to a custom module
> (.c and .h) within the src folder of my project. While doing so I
> managed to build the object file by keeping the sources in the source
> folder as described in the documentation. Unfortunately I get errors
> from the linker telling me that I have undefined references to my
> functions.

The most convenient way of adding additional sources to your
application outside zephyr is using

target_sources(app PRIVATE src1.c src2.c)

in the CMakeLists.txt of your application (there where you are
including Zephyr's boilerplate.cmake).

I'm not sure whether that answers your question. Feel free to give some
more details and code-example if appropriate.

best regards,

Join to automatically receive all group messages.