I'm marking this as a bug since usability has taken a hit vs previous versions.
Before 4.3 and the new CMake server mode, Qt Creator organised the files following the filesystem and CMake's add_subdirectory implied structure, which for most if not all users was enough and worked well. Since 4.3, the project tree has gained some quirks: each target has an additional <Source Directory> subtree, which increases the complexity in navigating the source files. Additionally, add_subdirectory projects' source files are shown to be in their subdirectory inside the <Source Directory>, even though they should not be.
CMake has, for a long time, provided simple ways to structure the generated IDE project files, using a global property (to enable the per-target property), a per-target property and a command:
- by calling
one can enable:
- the FOLDER target property: this will put a target into e.g. a Visual Studio "Solution Folder", allowing organisation of the different libraries/executables/... of the project/solution.
- the command source_group allows one to specify how the IDE organises the separate files of a single target.
For a real-life example, see my project: https://github.com/skui-org/skui
The intended solution/file structure is generated when generating Visual Studio project files. The problematic structure is generated on e.g. Linux using the "CodeBlocks - Ninja" generator. The CodeBlocks generator handles virtual folders just fine, but Qt Creator does not.