CMake - Adding LVGL export to project CMake

169 Views Asked by At

I have a project with a CMake build system and I want to add UI files from a Squareline Studio export to my project. The project has the following structure:

applications
├── my_app
├──── my_app.c
├──── my_app.h
├──── CMakeLists.txt
├──── ui_export
├────── ui.c
├────── ui.h
├────── etc.
├────── CMakeLists.txt

Squareline Studio exports the files in a directory called ui_export and this directory contains a CMakeLists.txt with the following content:

SET(SOURCES screens/ui_Screen1.c
    ui.c
    components/ui_comp_hook.c
    ui_helpers.c)

add_library(ui ${SOURCES})

The CMakeLists.txt in the my_app directory has the following content:

FILE(GLOB app_sources *.c)
target_sources(app PRIVATE ${app_sources})
add_subdirectory(ui_export)

I get the following error when starting the build process:

CMake Error at .../my_app/ui_export/CMakeLists.txt:6 (add_library):
  add_library cannot create target "ui" because another target with the same
  name already exists.  The existing target is a static library created in
  source directory ".../my_app/ui_export".  See
  documentation for policy CMP0002 for more details.

What does this error mean and how can I fix it? I´m sure that there is no second target called ui in the project, because the error stays the same when I rename the library.

0

There are 0 best solutions below