Modules with .c files in CMake

I’m in the process of converting some projects that use JUCE modules from Projucer to CMake and hit a problem with .c files. Projucer allows .c files in module root directories, e.g.


I was using that to bring in a C library (the top level .c includes more .c files in a sub directory) but C files don’t get picked up by add_module.

I’ve managed to get it to work by modifying JUCEUtils.cmake and changing the _juce_module_sources regex to find C files too:

list(FILTER module_cpp INCLUDE REGEX "^${base_path}[^/]*\\.\(cpp|c\)$")

I’m pretty new to CMake. Is this something that needs to be fixed in JUCE CMake or am I missing something about how modules work now?