CMake linking to juce modules

I think you’re probably running into the issue detailed here:

In short, the source grouping mechanism interacts poorly with target types not created with the juce_add_* functions.

I’d strongly recommend turning off source grouping if you can live without it. It won’t make any difference in Clion (afaik).

If you need to leave source groups enabled for some reason, you can call _juce_fixup_module_source_groups after adding your static library target, and this should sort things out, at the expense of making the build script a bit untidy.