This question is analog to Compile part of application as static library but related to a Matter application. In this case, I'd like to separate the compilation of all Matter/CHIP related application parts from my own application code, e.g., to use strict compiler flags for my own code which fail for the Matter/CHIP application parts.
My CMakeLists.txt looks as follows:
The last part is the relevant bit: chip_configure_data_model adds files from the Matter/CHIP repository to the given target, in this case still "app". What I'd like to do is the following (only repeating the relevant bits):
CMake detects the files and adds them to the library "app-chip", but it doesn't find the include paths for the Zephyr module Matter/CHIP. I can resolve it by copying the corresponding part from the "kernel.cmake", but I was wondering if there's a cleaner way to provide the required paths for a module to an application library:
This isn't very clean since it breaks immediately if "kernel.cmake" or some module setup in Zephyr breaks. Is there something like "target_link_libraries(app-chip PUBLIC zephyr_interface)" for Zephyr modules?