请教一个cmakelist.txt 编辑问题

ahtrunuw
Posts: 1
Joined: Sun Mar 07, 2021 2:45 pm

请教一个cmakelist.txt 编辑问题

Postby ahtrunuw » Sun Mar 07, 2021 2:57 pm

尝试把helloworld的函数独立写一个components出来但是遇到以下问题

Code: Untitled.bsh Select all

$ cmake
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.30.0.windows.2")
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe
-- Check for working CXX compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 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 esp32
-- Checking Python dependencies...
Python requirements from g:\work\esp\esp32\esp-idf\requirements.txt are satisfied.
CMake Error at G:/work/esp/esp32/esp-idf/tools/cmake/build.cmake:191 (message):
Failed to resolve component 'esp_spi_flash'.
Call Stack (most recent call first):
G:/work/esp/esp32/esp-idf/tools/cmake/build.cmake:217 (__build_resolve_and_add_req)
G:/work/esp/esp32/esp-idf/tools/cmake/build.cmake:437 (__build_expand_requirements)
G:/work/esp/esp32/esp-idf/tools/cmake/project.cmake:396 (idf_build_process)
CMakeLists.txt:6 (project)
红字部分应该如下解决 已经在REQUIRES添加

Code: Untitled.txt Select all

hi里面cmakelist如下
idf_component_register(SRCS "hi.c"
INCLUDE_DIRS "."
REQUIRES esp_spi_flash
)


main 里面cmakelist 如下
idf_component_register(SRCS "hello_world_main.c"
INCLUDE_DIRS "")


Code: Untitled.bat Select all

C:.
│ CMakeLists.txt
│ example_test.py
│ Makefile
│ README.md
│ sdkconfig

├─.vscode
│ c_cpp_properties.json
│ launch.json
│ settings.json
│ tasks.json

├─components
│ └─hi
│ CMakeLists.txt
│ hi.c
│ hi.h

└─main
CMakeLists.txt
component.mk
hello_world_main.c

Gargamel
Espressif staff
Espressif staff
Posts: 787
Joined: Wed Nov 14, 2018 8:45 am

Re: 请教一个cmakelist.txt 编辑问题

Postby Gargamel » Thu Mar 18, 2021 9:39 am

红色部分已解决的话,还有什么问题?方便的话,可以提供一个示例工程来分析解决。

Who is online

Users browsing this forum: No registered users and 1 guest