QtCreator CMake project - how to show all project files

后端 未结 6 1632
温柔的废话
温柔的废话 2020-12-17 08:07

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 vie

6条回答
  •  Happy的楠姐
    2020-12-17 09:05

    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)

提交回复
热议问题