Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
Qt Creator 4.12.0
-
None
-
423315178 (12.0)
Description
QtCreator should not create a top level virtual folder named TREE when using source_group(TREE <src>) command.
The reasoning for this is, as per CMake specs, the TREE option is a special argument for the source_group command, it is not the actual <name> argument, and as such it should be considered a distinct case, i.e. "CMake will automatically detect, from <src> files paths, source groups it needs to create, to keep structure of source groups analogically to the actual files and directories structure in the project. Paths of <src> files will be cut to be relative to <root>".
So in my opinion the actual fix would be simple: when source_group(TREE <src>) command is used, do not consider TREE as a group <name> argument but treat it as a special case (as per spec) and don't create a virtual folder named TREE (just use the the physical file organization from the file system, and place the top directories relative to the <root> as direct children of the project node).
As an example, when using source_group(TREE ${PROJECT_SOURCE_DIR}) the project structure:
1. should look like this (GOOD):
<target>
| actual_dir_on_fs
| src_file.h
| src_file.c
| another_actual_dir_on_fs
| another_src_file.h
| another_src_file.c
2. instead of (BAD):
<target>
| TREE
| actual_dir_on_fs
| src_file.h
| src_file.c
| another_actual_dir_on_fs
| another_src_file.h
| another_src_file.c
3. or instead of (BAD):
<target>
| Header Files
| actual_dir_on_fs
| src_file.h
| another_actual_dir_on_fs
| another_src_file.h
| Source Files
| actual_dir_on_fs
| src_file.c
| another_actual_dir_on_fs
| another_src_file.c
Applying the attached patch seems to fix the problem, and the project structure looks like case 1 above(0001-CMake-Proper-use-of-TREE-argument-in-source_group.patch).
Related issues: QTCREATORBUG-23372 and QTCREATORBUG-23318.
Attachments
Issue Links
- relates to
-
QTCREATORBUG-23957 Wrong project structure: CMake source_groups
- Closed
For Gerrit Dashboard: QTCREATORBUG-23942 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
513304,2 | CMakePM: Fix display of header / source files | 12.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |