Exclude some .c and .h files from build

Hey there !

It’s my first post here, so please correct me if I selected the wrong section for the following questions :slight_smile:

Some context :

  • I’m using platformio with vscode, and espidf framework.
  • I’ve a core system of files which is shared through different projects, and I want to do customization (specific to the project) with an “override” manner.
    => to do so, I have an “override” folder, and some files are copy pasted in it and modified, to override the original “core content”. Hence, I want to exclude from the build the core .c and .h files that have been duplicated… in order to build the project with the overridden ones and only.

That said, I tried many things… For example : using build_src_filter with espidf project has no effect…
=> “Warning: the ‘src_filter’ option cannot be used with ESP-IDF. Select source files to build in the project CMakeLists.txt file.”

I also tried to modify the CMakeLists.txt file with, for example :

   FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
   message("All sources: ${app_sources}")
   # Removing specific files from the build
     list(REMOVE_ITEM app_sources
     "${CMAKE_SOURCE_DIR}/src/test/test2.c"
  )
  idf_component_register(SRCS ${app_sources})

Which does not work either. But I doubt that the CMakeLists.txt file is even read by cMake, because the message does not seem to be displayed.

What am I missing here ? Is there a simple way to proceed ?

I’ve been trying for 2 days with many options and scripts, but got no luck until now…
I will appreciate your help ! thanks a lot

Up ? :smiley:
Any tip, remark or hint would be highly appreciated :slight_smile:
:pray::pray:

Hey There.

Still looking for a solution to the previous problem.

Did I miss something obvious there ? If so, please accept my apologies, and please share a link :pray:
Or maybe my description was not clear/precise enough ? Then please ask. I’ll be more than happy to give more context.

I feel alone with this, so please someone, say hi ? :slight_smile:
Best,
J

If you’re stuck, please search in https://github.com/platformio/platform-espressif32/issues or open a new issue there.