Context:
I am trying to add an external library which uses CMake to my Zephyr project. I have explored the modules documentation, but this does not seem a good fit as I am unable to modify the upstream library and would like to avoid forking.
To add the library, I am using FetchContent in my Cmake file. This is working successfully and I am able to download and build the files.
Problem:
When linking, I encounter a "Conflicting CPU architectures" error. After inspecting into compile_commands.json
, I can see the libraries source code is not receiving the same CMAKE_ARGS as the other files, leading to the architecture mismatch.
I am looking for the suggested way of adding external libraries to a zephyr project, without using the module system.
FetchContent_Declare(
my-lib
GIT_REPOSITORY git@github.com:<HostRepo>/<repoName>.git
GIT_TAG v0.1.7
)
FetchContent_MakeAvailable(my-lib)
target_link_libraries(app PRIVATE my-lib)