Linking VL53L0X Api

Hi everybody,

I’m new in CMake and I have some difficult to import VL53L0X Api to my ESP-IDF project.

I created inside Api folder this CMake.txt

then in main/Cmake.txt I called add_subdirectory(/Users/michelemocellin/Desktop/Api VL53L0X)

But when I reloaded CMake I received this error

add_library cannot create target “__idf_main” because another target with the same name already exists. The existing target is a static library created in source directory

What am I doing wrong ?
What is the best way to add that API ?

Hope your help, thank you.

It seems you have a conflicting target name. You’ll need to find and fix it.

Note that for using third-party libraries, find_package is generally better than add_subdirectory(/somewhere/not/in/the/main/project/tree).

Cc: @craig.scott