I wanted to create a shared / static library with my code that is written with amazon freertos and building successful. but unable to make it as library with cross-compiling for esp32.
while using add_library( ) with CMakeLists.txt it shows error to not found files of Freertos.h etc.
Can you show the command lines you used. Normally I would use the same compiler options (so there should be no difference in the include paths between creating an executable image and a static library) to build object files, using the -c option to GCC so the compiler stops at the object file. Then rather than using ld to link the object files into an executable file (or elf probably) I would use ar to place all the object files into an archive.
If the build system doesn’t already provide a mechanism to create an archive (I don’t have the docs for it), then you will have to edit the files to add that in. I can see a linker command line there which is presumably creating the executable, so guess you need something similar for the archiver.
… also I’m not aware of any shared library / dynamic linking support for deeply embedded systems especially when running from flash. If you really need a FreeRTOS as library then use a static one.