Adding shared library to project in nrfConnect SDK

Hi,

I am migrating code from NRF SK 17 to nrfConnect  SDK and I would like to create a library of source files to share between different apps.

I am able to add the individual source and header file files under a given app directory and compile with no issues, but when I try an compile the same files from a different location, I get an error about "/Users/nick/Documents/Developement/Nordic/nRFConnect/iemLibrary/src/iemGPIO.c:41:10: fatal error: zephyr.h: No such file or directory"

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(helios_tag)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE src/main.c)

#original location of files - this works
#target_sources(app PRIVATE src/iemRTC.c)
#target_sources(app PRIVATE src/iemI2C.c)
#target_sources(app PRIVATE src/iemGPIO.c)
#target_sources(app PRIVATE src/iemTimer.c)

target_include_directories(app PRIVATE include)

#new location files 
add_library( # Sets the name of the library.
        iemLibrary

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        ../iemLibrary/src/iemRTC.c
        ../iemLibrary/src/iemI2C.c
        ../iemLibrary/src/iemGPIO.c
        ../iemLibrary/src/iemTimer.c
       
)

Can anyone provide the cmake command that would resolve this?

I have tried "#target_include_directories(zephyr_interface include)" to no effect.

thanks...

Parents Reply Children
No Data
Related