Page 1 of 1

Best way to configure a library only project

Posted: Mon May 13, 2019 10:07 am
by william.ferguson.au
I have a ESP32 library component that I want to use in multiple ESP32 projects.
I plan to include it as a git submodule in the components folder of the client projects and have crafted the library's CMakeLists.txt to reflect that it is a component of another project. This works well when compiling the client projects.

Eg

Code: Select all

SET (COMPONENT_REQUIRES
        arduino-esp32
        lwip
)

SET (COMPONENT_ADD_INCLUDEDIRS includes)
SET (COMPONENT_SRCS
        "src/foo.c"
        "src/bar.c"
)

register_component()
But is there a way for me to also be able to compile the library project standalone?
If so how?
Do I have a second CMakeLists.txt for the library? If so, what does it look like (I can't get anything to compile)?
And how do I invoke a different CMakeLists.txt?

Or is there another way that I should be thinking about this?