getting non-simply named items in Header and Source Files in the project tree (Cmake)
-
I try to define my file groups in
CMakeLists.txtso that they appear underHeader FilesandSource Files, respectively. Filespecs using a path (often ../...) are not shown where expected. I noticed that the files (in the groups) have to be found in theset(Header_Files ...)command, so I tried to useinclude_directories(...)with the path strings in question, but that did not help to make the files (names without path) findable, and usingtarget_include_directories(target, ...)is not possible because the groups are needed to define the target (add_executable(...)) in the first place.
So I decided to call it a catch-22 and accept that some sourcy files end up under <Other Locations>. Or perhaps I overlooked something? Interesting to hear from you! -
I try to define my file groups in
CMakeLists.txtso that they appear underHeader FilesandSource Files, respectively. Filespecs using a path (often ../...) are not shown where expected. I noticed that the files (in the groups) have to be found in theset(Header_Files ...)command, so I tried to useinclude_directories(...)with the path strings in question, but that did not help to make the files (names without path) findable, and usingtarget_include_directories(target, ...)is not possible because the groups are needed to define the target (add_executable(...)) in the first place.
So I decided to call it a catch-22 and accept that some sourcy files end up under <Other Locations>. Or perhaps I overlooked something? Interesting to hear from you!@janhec have a look at CMake's source_group which is also used by Qt Creator to organize the project view.