QtCreator+cmake: list all files in project tree
-
I'm working on a cmake based project (non-Qt) and I want to open and edit the project with the QtCreator. I was able to oben, configure and build the project with QtCreator but now I noticed that not all files are listed in the project tree:
TheCmakeLists.txtfiles reference only the.cppfiles so the QtCreator lists only the named.cppfiles and their corresponding.hppfile. There are also several header only implementations which are included in some cpp files but which are not listed in the cmake files so the QtCreator does not show them in the project tree.
(I did not create this cmake structure so I do not want to discuss if this is a wrong usage of cmake or not).My question is: Does anyone know a trick how to list all files in the project tree, regardless whether the files are listed in
CMakeLists.txtor not.
I'm looking for a way without editing / fixing / adjusting all the CMakeLists.txt (e.g. Eclipse/CDT lists all files found in the filesystem and that might be the reason why these cmake files contain no header files). -
Hi! You can change the view from "Projects" to "File System". Above the treeview, there is a combobox where you can switch between the settings.
-
Hi! You can change the view from "Projects" to "File System". Above the treeview, there is a combobox where you can switch between the settings.
-
I found a solution that works for me: Instead of editing all the CMakeLists.txt I can add a dummy target in the top most
CMakeLists.txtthat collects all header files:file(GLOB_RECURSE ALL_SRC_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Source/*.hpp") file(GLOB_RECURSE ALL_TEST_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Tests/*.hpp") add_library(dummy_target_with_all_headers EXCLUDE_FROM_ALL ${ALL_SRC_HEADER_FILES} ${ALL_TEST_HEADER_FILES}) target_link_libraries(dummy_target_with_all_headers) set_target_properties(dummy_target_with_all_headers PROPERTIES LINKER_LANGUAGE CXX)But I'm still looking for a way to move this target declaration to a separate file and pass this file as an additional command line argument to cmake so I don't have to modify the existing
CMakeLists.txtfile... -
I found a solution that works for me: Instead of editing all the CMakeLists.txt I can add a dummy target in the top most
CMakeLists.txtthat collects all header files:file(GLOB_RECURSE ALL_SRC_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Source/*.hpp") file(GLOB_RECURSE ALL_TEST_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Tests/*.hpp") add_library(dummy_target_with_all_headers EXCLUDE_FROM_ALL ${ALL_SRC_HEADER_FILES} ${ALL_TEST_HEADER_FILES}) target_link_libraries(dummy_target_with_all_headers) set_target_properties(dummy_target_with_all_headers PROPERTIES LINKER_LANGUAGE CXX)But I'm still looking for a way to move this target declaration to a separate file and pass this file as an additional command line argument to cmake so I don't have to modify the existing
CMakeLists.txtfile...