Subfolders structure and CMakeLists.txt

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

Subfolders structure and CMakeLists.txt

Postby KanyeKanye » Wed Jun 19, 2019 3:50 pm

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?

Who is online

Users browsing this forum: Majestic-12 [Bot] and 135 guests