Is this a good directory structure to maintain a large C++ project?

Viewed 2041

I have been trying to figure out a good directory structure that is maintainable for large C++ projects. During my search I came across this resource here link. If I loosely follow the structure stated in that document, it seems I get something similar to the following

.
├── CMakeLists.txt
├── build
│   ├── Executable-OutputA
│   └── Library-OutputA
├── cmake
│   └── *.cmake
├── docs
├── include
│   └── *.h
├── lib
│   ├── LibraryA
│   │   ├── *.cpp
│   │   └── *.h
│   └── LibraryB
│       ├── *.cpp
│       └── *.h
├── src
│   ├── ExecutableA
│   │   ├── *.cpp
│   │   └── *.h
│   └── ExecutableB
│       ├── *.cpp
│       └── *.h
├── tests
└── third_party
    ├── External-ProjectA
    └── External-ProjectB
  • build: holds the outputted executables and libraries generated by the project
  • cmake: holds all the cmake packages that the project may require
  • doc: holds documentation files, typically doxygen
  • include: holds public headers files (might not be needed, not sure)
  • lib: holds all the libraries the user creates with their respective source and header files
  • src: holds all the executable projects the user makes with their respective headers and source files
  • tests: files to test both the executables and libraries
  • third_party: any third party projects, libraries, ect. usually downloaded from online or cloned

I believe this is an appropriate structure for large projects, but I do not have too much experience with projects that produce more than 3 or 4 targets. I want to ask the community for feedback and if they agree with the structure laid out above, or have better suggestions.

Edit: I have not been able to find too many posts detailing multiple target outputs as well as third party dependencies for large projects.

0 Answers
Related