Adding additional components via Kconfig

Julian
Posts: 2
Joined: Sat Nov 16, 2019 9:41 am

Adding additional components via Kconfig

Postby Julian » Sun Nov 08, 2020 12:47 pm

I am writing a component where I want the possibility to enable advanced features that depend on other components (in this case lvgl).
The CMakeList.txt looks like this (simplified)

Code: Select all

if(CONFIG_USE_LVGL)
    set(priv_requires driver freertos lvgl)
    message("LVGL enabled")
else()
    set(priv_requires driver freertos)
    #The following works???
    #set(priv_requires driver freertos lvgl)
    message("LVGL disabled")
endif()

message("priv_requires: ${priv_requires}")
idf_component_register(SRCS "${srcs}"
                        INCLUDE_DIRS include
                        PRIV_INCLUDE_DIRS source
                        PRIV_REQUIRES "${priv_requires}")
I can see the "LVGL enabled" output and the correct content of priv_requires on the console, however a build fails because it complains about missing the lvgl.h header file. The include is not present in the build.ninja for the appropriate target. However when I uncomment the line in the else clause then it works and the build.ninja gets generated correctly. Can someone tell me what I am doing wrong?

I am using esp-idf v4.1 and VisualGDB

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot], MicroController and 67 guests