Skip to content

Commit 744b457

Browse files
committed
cmake: define edge_impulse as a static imported library
The edge impulse library is created using ExternalProject_Add. This means the library is not a regular CMake library but an imported library. In general CMake is happy to link directly to a library using its path, however in the edge_impulse library case, the edge_impulse itself needs to link against the Zephyr kernel library as it calls kernel functions. Therefore a link dependency to Zephyr kernel lib must be created and to do so, edge impulse must be a known library target. A static imported Edge impulse pointing to the external project generated library file is created so that a CMake library target exists. Jira: NCSDK-24520 Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
1 parent cca8452 commit 744b457

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/edge_impulse/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ ExternalProject_Add(edge_impulse_project
6868
USES_TERMINAL_BUILD True
6969
)
7070
add_dependencies(edge_impulse_project zephyr_generated_headers)
71+
add_library(edge_impulse_imported STATIC IMPORTED)
72+
set_target_properties(edge_impulse_imported PROPERTIES IMPORTED_LOCATION ${EDGE_IMPULSE_LIBRARY})
73+
target_link_libraries(edge_impulse_imported INTERFACE kernel)
7174

7275
# This targets remove the `edge_impulse_project-download` stamp file, which
7376
# causes the Edge impulse library to be fetched on each build invocation.
@@ -106,7 +109,7 @@ target_include_directories(edge_impulse INTERFACE
106109
${EDGE_IMPULSE_SOURCE_DIR}/edge-impulse-sdk/CMSIS/Core/Include
107110
)
108111

109-
target_link_libraries(edge_impulse INTERFACE ${EDGE_IMPULSE_LIBRARY})
112+
target_link_libraries(edge_impulse INTERFACE edge_impulse_imported)
110113

111114
add_dependencies(edge_impulse
112115
zephyr_interface

0 commit comments

Comments
 (0)