Reply to an old topic, but I thought I would share. This cmake definition works, but ignores the actual sysroot and causes workarounds needed to do linking. To fix this, you need to tell cmake to define SYSROOT with the following. I create a new variable CMAKE_FIND_TARGET_PATH and point it to the sysroot path in the lede build area. The compiler needs to be told that sysroot is not the compiler path, but the actual target filesystem area. This is an important distinction, and avoids having to use -rpath and other linker options. SET(CMAKE_FIND_TARGET_PATH <path to>/staging_dir/target-mipsel_24kc_musl) SET (CMAKE_SYSROOT ${CMAKE_FIND_TARGET_PATH}) Finally, you need to tell the compiler where the sysroot include directories are ADD_DEFINITIONS ("-isystem <path to>/staging_dir/target-mipsel_24kc_musl/usr/include") Then, you can use the following logic in your local CMakeLists.txt to find Onion libraries. add_library (onioni2c SHARED IMPORTED) set_target_properties(onioni2c PROPERTIES IMPORTED_LOCATION "${CMAKE_FIND_TARGET_PATH}/usr/lib/libonioni2c.so") This will make it work with the compiler std paths (so std::cout will be found and work correctly), and it will allow you to find <onion-i2c.h> and the others correctly. Hope this helps everyone.