Normally, STM32CubeIDE/Eclipse compiles all the C files that are located in same directory (and in sub directories) as project files .project and .cproject .
If you create a project in STM32CubeIDE from scratch with just a STM32 chip ID (not from an example), there is an option "Generate under root" in Code Generator in STM32CubeIDE that corresponds to this configuration. The .project and .cproject files are located at the root of the project directory and all the Drivers/ and Middleware files are copied under. They are all compiled by default. They are not links.
STM32CubeIDE/Eclipse "links" are only used when source files are "above" or in other directory than the one containing .project and .cproject files.
A lot of examples and cube expansion packs are delivered with this configuration (using links). The .project and .cproject files are delivered in a STM32CubeIDE subdirectory. They are made like this. It's too complicated to change them to "generate at root" style.