Creating a component from a prebuilt lib
Posted: Wed Jul 08, 2020 1:52 pm
Hello,
I want to create custom components with prebuilt libraries, for example:
Component name foo
Component files: foo.a foo.h
I have been trying to create this component from the import_prebuilt example, but in that example
the lib is imported directly to the main component.
I modified the import_prebuilt example so the project has the following structure:
import_prebuilt
-- components
----- prebuilt
-------- prebuilt.a
-------- prebuilt.h
-------- CMakeList.txt
-- main
----- main.c
----- CMakeList.txt
-- CMakeList.txt
I tried to write the CMakeList.txt of the prebuilt component as:
But it didnĀ“t work.. I am still a newbie with CMake How should I write this file in order to correctly create a component?
The rest of the CMakeList.txt files are the minimum required to successfully compile the project.
I am using IDF 4.1
import_prebuilt example:
https://github.com/espressif/esp-idf/tr ... t_prebuilt
Thanks for your help
I want to create custom components with prebuilt libraries, for example:
Component name foo
Component files: foo.a foo.h
I have been trying to create this component from the import_prebuilt example, but in that example
the lib is imported directly to the main component.
I modified the import_prebuilt example so the project has the following structure:
import_prebuilt
-- components
----- prebuilt
-------- prebuilt.a
-------- prebuilt.h
-------- CMakeList.txt
-- main
----- main.c
----- CMakeList.txt
-- CMakeList.txt
I tried to write the CMakeList.txt of the prebuilt component as:
Code: Select all
idf_component_register(INCLUDE_DIRS .)
add_prebuilt_library(libprebuilt "libprebuilt.a"
PRIV_REQUIRES spi_flash app_update log)
target_link_libraries(${COMPONENT_LIB} PUBLIC libprebuilt)
The rest of the CMakeList.txt files are the minimum required to successfully compile the project.
I am using IDF 4.1
import_prebuilt example:
https://github.com/espressif/esp-idf/tr ... t_prebuilt
Thanks for your help