How to include libcurl in an ESP32 project

Viewed 314

My question is basically in the title.

My directory structure of our esp32 project (the important parts i think) is as followed:

Directory
.vscode
components curl
esp32-wifi-manager
build
main CMakeLists.txt
main.c
.gitignore
CMakeLists.txt
sdkconfig
sdkconfig.old

The steps that i did to include libcurl were these:

  1. git clone https://github.com/curl/curl.git (into the components folder)
  2. And then moved 2 files into the curl directory
    -lib/curl_config.h
    -component.mk

See instructions and files at https://github.com/nkolban/esp32-snippets/tree/master/curl/build_files or at the related video https://www.youtube.com/watch?v=tp4OC_kGMgU&t=603s .

The only diffrence that I noticed would be the console and the commands that we use to build.

We use "ESP-IDF 4.4 CMD" and the command "idf.py build".

This is the output in the console.


Executing action: all (aliases: build)  
Running ninja in directory c:\users\name\desktop\project\mainproject\build  
Executing "ninja all"...  
[0/1] Re-running CMake...  
-- ccache will be used for faster recompilation  
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.  
-- Building ESP-IDF components for target esp32s2
CMake Error at C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/component.cmake:219 (message):
  CMake Warning (dev) at build_properties.temp.cmake:7:

    Syntax Warning in cmake code at column 51



    Argument not separated from preceding token by whitespace.

  Call Stack (most recent call first):

    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:3 (include)

  This warning is for project developers.  Use -Wno-dev to suppress it.



  fatal: not a git repository (or any of the parent directories): .git

  CMake Error at
  C:/Users/name/Desktop/project/mainproject/components/curl/CMakeLists.txt:43
  (include):
 
    include could not find requested file:



      Utilities

  Call Stack (most recent call first):

    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:106 (include)
    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:124 (__component_get_requirements)





Call Stack (most recent call first):
  C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/build.cmake:491 (__component_get_requirements)
  C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/project.cmake:378 (idf_build_process)
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!

In CMakeLists.txt in components/curl/ the include lines dont seem to work (e.g. Utilities).
If we try an absolute path instead of ${CMAKE_CURRENT_SOURCE_DIR} (see beneath) an error accurs later in the line "project(CURL C)". Then the error says: "project command is not scriptable".

cmake_minimum_required(VERSION 3.2...3.16 FATAL_ERROR)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
include(Utilities)
include(Macros)
include(CMakeDependentOption)
include(CheckCCompilerFlag)

project(CURL C)
0 Answers
Related