Page 1 of 1

Subfolders structure and CMakeLists.txt

Posted: Wed Jun 19, 2019 3:50 pm
by KanyeKanye
I cant execute (because 'undefined reference to `test_function'') any function from subfolder.
My files structure looks like:

Code: Select all

PROJECT
  CMakeLists.txt
  - main
    main.c
    component.mk
    CMakeLists.txt
    -- subfolder
    file.c
    file.h
    component.mk
CMakeLists.txt (/main/CMakeLists.txt) like:

Code: Select all

set(COMPONENT_ADD_INCLUDEDIRS include)
#set(COMPONENT_ADD_INCLUDEDIRS ".")

set(MAIN_SRCS "main.c" 
	"subfolder/file.c")
	
set(COMPONENT_SRCS ${MAIN_SRCS})
add_executable(${PROJECT_NAME} ${MAIN_SRCS})

set(COMPONENT_REQUIRES driver sdmmc)

register_component()
How to valid cmakefile for subfolder project structure?