Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QtCreator CMake project - how to show all project files

I use QtCreator to open CMake project. Some directories apart from CMakeLists.txt contains only headers files *.h and for those directories QtCreator in the project tree view shows only CMakeLists.txt. How to fix that ? I need to see all project files from QtCreator.

like image 445
Irbis Avatar asked Feb 07 '15 17:02

Irbis


People also ask

How do you use CMake Qtcreator?

Qt Creator uses the default CMake if it does not have enough information to choose the CMake to use. To set the selected CMake executable as the default, select Make Default. To remove the selected CMake executable from the list, select Remove. Select the Kits tab to add the CMake tool to a build and run kit.

What is difference between Qmake and CMake?

CMake is an alternative to qmake for automating the generation of build configurations. Qbs is an all-in-one build tool that generates a build graph from a high-level project description (like qmake or CMake do) and executes the commands in the low-level build graph (like make does).


2 Answers

I would suggest you switching your project view to File System. This would display a view where you could view any file you want:

enter image description here

You might want to split your project view into two by clicking the second to right button, if you still desire the Projects mode.

like image 21
Jingjie Zheng Avatar answered Sep 22 '22 06:09

Jingjie Zheng


Viewing project as a file system is not a solution at all cause your project editor settings for example would not apply. And I do not like to add headers to executable target, cause they do not actually belong there. You effectively cripple the project file to work nicely with one particular IDE... not good. The cleaner option IMHO would be:

FILE(GLOB_RECURSE LibFiles "include/*.hpp") add_custom_target(headers SOURCES ${LibFiles}) 

As a bonus you get your includes shown in a separate folder. (borrowed from https://cmake.org/pipermail/cmake/2012-August/051811.html)

like image 69
Slava Avatar answered Sep 20 '22 06:09

Slava