GNU Make to CMake migration issue
Posted: Fri Aug 30, 2019 10:21 am
Hi
I have a project compile and run OK with GNU Make (ESP-IDF v4.1/3.2.2). Now I wish to include CMakeLists.txt to make this project compatible with CMake but there are issues.
The folder hierarchy of my project is like:
Component file 'component.mk' in my_component/ folder is listed below:
An attempt to migrate it to CMake-based with CMakeLists.txt listed below:
All .c and .h files are at the same level in each of the Framework/, Widgets/, and HAL/ folders. That means there is no sub-folder inside.
Unfortunately it doesn't compile with CMake. I just ran idf.py clean > idf.py menuconfig >idf.py build with error:
fatal error: esp_vfs_fat.h: No such file or directory.
No modification to source code or folder structure has been made between make and idf.py build. This esp_vfs_fat.h file was found with GNU Make but not CMake.
I am wondering if my CMakeLists.txt has some mistake so that some of the files are not found.
Any idea?
BR
John
I have a project compile and run OK with GNU Make (ESP-IDF v4.1/3.2.2). Now I wish to include CMakeLists.txt to make this project compatible with CMake but there are issues.
The folder hierarchy of my project is like:
Code: Select all
-HelloWorld/
- CMakeLists.txt
- Makefile
- sdkconfig
- components/ - my_component/
- CMakeLists.txt
- component.mk
- Framework/ #folder empty for now
- Widgets/ #folder empty for now
- HAL/ #.c and .h files in the same level
- main/
- CMakeLists.txt
- component.mk
- main.c
Code: Select all
COMPONENT_ADD_INCLUDEDIRS := Framework \
Widgets \
HAL
COMPONENT_SRCDIRS := Framework \
Widgets \
HAL
#override compiler flags in ESP32 IDF to change some warnings to errors
CFLAGS+=-Wno-error=missing-braces -DMY_OPTIONS -D_DEBUG
Code: Select all
file(GLOB my_srcs Framework/*.c Widgets/*.c HAL/*.c)
set (COMPONENT_ADD_INCLUDEDIRS "Framework" "Widgets" "HAL")
set (COMPONENT_SRCS ${my_srcs})
register_component()
target_compile_definitions(${COMPONENT_TARGET} PUBLIC "-DMY_OPTION" "-D_DEBUG")
Unfortunately it doesn't compile with CMake. I just ran idf.py clean > idf.py menuconfig >idf.py build with error:
fatal error: esp_vfs_fat.h: No such file or directory.
No modification to source code or folder structure has been made between make and idf.py build. This esp_vfs_fat.h file was found with GNU Make but not CMake.
I am wondering if my CMakeLists.txt has some mistake so that some of the files are not found.
Any idea?
BR
John